protobuf

package
v2.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WrapperBool   = "google.protobuf.BoolValue"
	WrapperBytes  = "google.protobuf.BytesValue"
	WrapperDouble = "google.protobuf.DoubleValue"
	WrapperFloat  = "google.protobuf.FloatValue"
	WrapperInt32  = "google.protobuf.Int32Value"
	WrapperInt64  = "google.protobuf.Int64Value"
	WrapperString = "google.protobuf.StringValue"
	WrapperUInt32 = "google.protobuf.UInt32Value"
	WrapperUInt64 = "google.protobuf.UInt64Value"
	WrapperVoid   = "google.protobuf.EMPTY"
)

Variables

View Source
var WRAPPER_TYPES = map[string]struct{}{
	WrapperBool:   {},
	WrapperBytes:  {},
	WrapperDouble: {},
	WrapperFloat:  {},
	WrapperInt32:  {},
	WrapperInt64:  {},
	WrapperString: {},
	WrapperUInt32: {},
	WrapperUInt64: {},
}

Functions

func NewConverter

func NewConverter(schemaFile string, soFile string, messageName string) (message.Converter, error)

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

func (*Converter) Decode

func (c *Converter) Decode(ctx api.StreamContext, b []byte) (m any, err error)

func (*Converter) Encode

func (c *Converter) Encode(ctx api.StreamContext, d any) (b []byte, err error)

type FieldConverter

type FieldConverter struct{}

func GetFieldConverter

func GetFieldConverter() *FieldConverter

func (*FieldConverter) DecodeField

func (fc *FieldConverter) DecodeField(src interface{}, field *desc.FieldDescriptor, sn cast.Strictness) (interface{}, error)

func (*FieldConverter) DecodeMap

func (fc *FieldConverter) DecodeMap(src map[string]interface{}, ft *desc.MessageDescriptor, sn cast.Strictness) (map[string]interface{}, error)

func (*FieldConverter) DecodeMessage

func (fc *FieldConverter) DecodeMessage(message *dynamic.Message, outputType *desc.MessageDescriptor) interface{}

func (*FieldConverter) EncodeField

func (fc *FieldConverter) EncodeField(field *desc.FieldDescriptor, v interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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