dts

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 4 Imported by: 11

README

dts-stream-go

Go Reference GoReportCard codecov

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

dts-stream-go is a streaming version of 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 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

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

Marshal marshals DTM + data.

func (DTS[T]) Size

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

Size calculates the size of the DTM + data.

func (DTS[T]) Skip

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

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

SkipData skips only data.

func (DTS[T]) Unmarshal

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

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