dts

package module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 4 Imported by: 0

README

mus-stream-dts-go

Go Reference GoReportCard codecov

mus-stream-dts-go provides DTM support for the mus-stream-go serializer.

mus-stream-dts-go is a streaming version of mus-dts-go. It has the same structure, but uses the Writer and Reader interfaces instead of byte slices.

How To

You can learn more about this in the mus-dts-go documentation.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DTMSer = dtmSer{}
View Source
var ErrWrongDTM = errors.New("wrong data type metadata")

ErrWrongDTM happens when DTS tries to unmarshal data with wrong DTM.

Functions

This section is empty.

Types

type DTS

type DTS[T any] struct {
	// contains filtered or unexported fields
}

DTM implements the mus.Serializer interface and provides DTM support for the mus-stream-go serializer. It helps to serializer DTM + data.

func New

func New[T any](dtm com.DTM, ser muss.Serializer[T],
) DTS[T]

New creates a new DTS.

func (DTS[T]) DTM

func (d DTS[T]) DTM() com.DTM

DTM returns the initialization value.

func (DTS[T]) Marshal added in v0.4.0

func (d DTS[T]) Marshal(t T, w muss.Writer) (n int, err error)

Marshal marshals DTM + data.

func (DTS[T]) Size added in v0.4.0

func (d DTS[T]) Size(t T) (size int)

Size calculates the size of the DTM + data.

func (DTS[T]) Skip added in v0.5.0

func (d DTS[T]) Skip(r muss.Reader) (n int, err error)

Skip skips DTM + data.

Returns ErrWrongDTM if the unmarshalled DTM differs from the dts.DTM().

func (DTS[T]) SkipData added in v0.5.0

func (d DTS[T]) SkipData(r muss.Reader) (n int, err error)

SkipData skips only data.

func (DTS[T]) Unmarshal added in v0.4.0

func (d DTS[T]) Unmarshal(r muss.Reader) (t T, n int, err error)

Unmarshal unmarshals DTM + data.

Returns ErrWrongDTM if the unmarshalled DTM differs from the dts.DTM().

func (DTS[T]) UnmarshalData added in v0.2.0

func (d DTS[T]) UnmarshalData(r muss.Reader) (t T, n int, err error)

UnmarshalData unmarshals only data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL