serializers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIsNotAvro = errors.New("Is not avro")
View Source
var SupportedSerializers = []string{
	"raw", "protobuf", "avro", "msgpack", "base64",
}

Functions

This section is empty.

Types

type AvroSerializer

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

func NewAvroSerializer

func NewAvroSerializer(
	avroSchemaCacheURL string,
	schemaID int,
) (*AvroSerializer, error)

func (*AvroSerializer) Decode

func (as *AvroSerializer) Decode(raw []byte) ([]byte, error)

func (*AvroSerializer) Encode

func (as *AvroSerializer) Encode(input []byte) ([]byte, error)

type Base64Serializer

type Base64Serializer struct{}

func NewBase64Serializer

func NewBase64Serializer() *Base64Serializer

func (*Base64Serializer) Decode

func (bs *Base64Serializer) Decode(input []byte) ([]byte, error)

func (*Base64Serializer) Encode

func (bs *Base64Serializer) Encode(input []byte) ([]byte, error)

type DescriptorRegistry

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

func NewDescriptorRegistry

func NewDescriptorRegistry(importPaths []string, exclusions []string) (*DescriptorRegistry, error)

func (*DescriptorRegistry) MessageForType

func (d *DescriptorRegistry) MessageForType(_type string) *dynamic.Message

type MessagePackSerializer

type MessagePackSerializer struct{}

func NewMessagePackSerializer

func NewMessagePackSerializer() *MessagePackSerializer

func (*MessagePackSerializer) Decode

func (mp *MessagePackSerializer) Decode(input []byte) ([]byte, error)

func (*MessagePackSerializer) Encode

func (mp *MessagePackSerializer) Encode(input []byte) ([]byte, error)

type ProtobufSerializer

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

func NewProtobufSerializer

func NewProtobufSerializer(importPaths, excludePath []string, protoType string) (*ProtobufSerializer, error)

func (*ProtobufSerializer) Decode

func (ps *ProtobufSerializer) Decode(data []byte) ([]byte, error)

func (*ProtobufSerializer) Encode

func (ps *ProtobufSerializer) Encode(raw []byte) ([]byte, error)

func (*ProtobufSerializer) GetExample

func (ps *ProtobufSerializer) GetExample(protoType string) string

type RawSerializer

type RawSerializer struct{}

func NewRawSerializer

func NewRawSerializer() *RawSerializer

func (*RawSerializer) Decode

func (re *RawSerializer) Decode(input []byte) ([]byte, error)

func (*RawSerializer) Encode

func (re *RawSerializer) Encode(input []byte) ([]byte, error)

type SchemaCache

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

SchemaCache connects to the Confluent schema registry and maintains a cached versions of Avro schemas and codecs.

func NewSchemaCache

func NewSchemaCache(url string) (*SchemaCache, error)

NewSchemaCache returns a new Cache instance

func (*SchemaCache) DecodeMessage

func (c *SchemaCache) DecodeMessage(b []byte) (message []byte, err error)

DecodeMessage returns a text representation of an Avro-encoded message.

func (*SchemaCache) EncodeMessage

func (c *SchemaCache) EncodeMessage(schemaID int, json []byte) (message []byte, err error)

EncodeMessage returns a binary representation of an Avro-encoded message.

Jump to

Keyboard shortcuts

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