ext

package module
v0.0.0-...-86101cc Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 9 Imported by: 1

README

ext-protobuf-go

Provides a mus-go serializer extension for the Protobuf format.

Includes the MarshallerProtobuf interface, which represents a type that can marshal itself into the Protobuf format, along with the generic MarshalProtobuf function. Also includes the MarshallerTypedProtobuf interface and the MarshalTypedProtobuf function, intended for use with DTS.

Contains serializers for string, slice and timestamp types.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LenSer       = lenSer{}
	String       = ord.NewStringSer(strops.WithLenSer(LenSer))
	StringUnsafe = unsafe.NewStringSer(strops.WithLenSer(LenSer))
)
View Source
var TimestampNativeProtobuf = timestampNativeProtobuf{}
View Source
var TimestampProtobuf = timestampProtobuf{}

Functions

func MarshalProtobuf

func MarshalProtobuf(v MarshallerProtobuf) (bs []byte)

MarshalProtobuf creates and returns a byte slice filled with the serialized data.

func MarshalTypedProtobuf

func MarshalTypedProtobuf(v MarshallerTypedProtobuf) (bs []byte)

MarshalTypedProtobuf creates and returns a byte slice filled with the serialized data.

func NewSliceProtobuf

func NewSliceProtobuf[T any](elemProtobuf mus.Serializer[T]) sliceProtobuf[T]

NewSliceSer returns a new slice serializer with the given element serializer.

func NewValidSliceProtobuf

func NewValidSliceProtobuf[T any](elemProtobuf mus.Serializer[T],
	ops ...slops.SetOption[T]) validSliceProtobuf[T]

NewValidSliceSer returns a new valid slice serializer.

func NewValidStringProtobuf

func NewValidStringProtobuf(ops ...strops.SetOption) mus.Serializer[string]

NewValidStringProtobuf returns a new valid string serializer.

func NewValidStringUnsafeProtobuf

func NewValidStringUnsafeProtobuf(ops ...strops.SetOption) mus.Serializer[string]

NewValidStringUnsafeProtobuf returns a new valid string serializer.

Types

type MarshallerProtobuf

type MarshallerProtobuf interface {
	MarshalProtobuf(bs []byte) (n int)
	SizeProtobuf() (size int)
}

MarshallerProtobuf interface wraps MarhsalProtobuf and SizeProtobuf methods.

type MarshallerTypedProtobuf

type MarshallerTypedProtobuf interface {
	MarshalTypedProtobuf(bs []byte) (n int)
	SizeTypedProtobuf() (size int)
}

MarshallerProtobuf interface wraps the MarshalProtobuf and SizeProtobuf methods. It is intended for use with DTS.

type Timestamp

type Timestamp struct {
	Seconds int64
	Nanos   int32
}

Jump to

Keyboard shortcuts

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