protobuf

package
v2.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 47 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deserializer

type Deserializer struct {
	serde.BaseDeserializer
	*Serde
	ProtoRegistry *protoregistry.Types
}

Deserializer represents a Protobuf deserializer

func NewDeserializer

func NewDeserializer(client schemaregistry.Client, serdeType serde.Type, conf *DeserializerConfig) (*Deserializer, error)

NewDeserializer creates a Protobuf deserializer for Protobuf-generated objects

func (*Deserializer) ConfigureDeserializer

func (s *Deserializer) ConfigureDeserializer(client schemaregistry.Client, serdeType serde.Type,
	conf *serde.DeserializerConfig) error

ConfigureDeserializer configures the Protobuf deserializer

func (*Deserializer) Deserialize

func (s *Deserializer) Deserialize(topic string, payload []byte) (interface{}, error)

Deserialize implements deserialization of Protobuf data

func (*Deserializer) DeserializeInto

func (s *Deserializer) DeserializeInto(topic string, payload []byte, msg interface{}) error

DeserializeInto implements deserialization of Protobuf data to the given object

type DeserializerConfig

type DeserializerConfig struct {
	serde.DeserializerConfig
}

DeserializerConfig is used to pass multiple configuration options to the deserializers.

func NewDeserializerConfig

func NewDeserializerConfig() *DeserializerConfig

NewDeserializerConfig returns a new configuration instance with sane defaults.

type Serde added in v2.5.0

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

Serde represents a Protobuf serde

func (*Serde) FieldTransform added in v2.5.0

func (s *Serde) FieldTransform(client schemaregistry.Client, ctx serde.RuleContext, fieldTransform serde.FieldTransform, msg interface{}) (interface{}, error)

FieldTransform transforms the field value using the rule

type Serializer

type Serializer struct {
	serde.BaseSerializer
	*Serde
	Conf *SerializerConfig
	// contains filtered or unexported fields
}

Serializer represents a Protobuf serializer

func NewSerializer

func NewSerializer(client schemaregistry.Client, serdeType serde.Type, conf *SerializerConfig) (*Serializer, error)

NewSerializer creates a Protobuf serializer for Protobuf-generated objects

func (*Serializer) Serialize

func (s *Serializer) Serialize(topic string, msg interface{}) ([]byte, error)

Serialize implements serialization of Protobuf data

type SerializerConfig

type SerializerConfig struct {
	serde.SerializerConfig
	// CacheSchemas will cache serialization results based on the name of the protobuf file
	// corresponding to the message being serialized. This will drastically improve serialization
	// performance if you are only ever using a _single_ version of a specific protobuf schema
	// during any given run of your application. This should be the case for most applications,
	// but might not apply if you're not creating proto messages based on generated files (e.g.
	// you are proxying or reading raw protobuf messages from a data source), or if for some reason
	// you are including multiple versions of the same schema/protobuf in your application.
	CacheSchemas bool
}

SerializerConfig is used to pass multiple configuration options to the serializers.

func NewSerializerConfig

func NewSerializerConfig() *SerializerConfig

NewSerializerConfig returns a new configuration instance with sane defaults.

Jump to

Keyboard shortcuts

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