Documentation
¶
Overview ¶
Package protoavro provides functions for converting between Protocol Buffers and Avro.
Index ¶
- func InferSchema(desc protoreflect.MessageDescriptor) (avro.Schema, error)
- type Marshaler
- type SchemaOptions
- func (o SchemaOptions) Encode(message proto.Message) (interface{}, error)
- func (o SchemaOptions) InferSchema(desc protoreflect.MessageDescriptor) (avro.Schema, error)
- func (o SchemaOptions) NewMarshaler(descriptor protoreflect.MessageDescriptor, writer io.Writer) (*Marshaler, error)
- func (o SchemaOptions) NewUnmarshaler(reader io.Reader) (*Unmarshaler, error)
- type Unmarshaler
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InferSchema ¶
func InferSchema(desc protoreflect.MessageDescriptor) (avro.Schema, error)
InferSchema returns the Avro schema, with default SchemaOptions, for the protobuf message descriptor.
Example ¶
Output: true
Types ¶
type Marshaler ¶
type Marshaler struct {
// contains filtered or unexported fields
}
Marshaler encodes and writes Avro binary encoded messages.
Example ¶
Output:
func NewMarshaler ¶
func NewMarshaler(descriptor protoreflect.MessageDescriptor, writer io.Writer) (*Marshaler, error)
NewMarshaler returns a new marshaler, with default SchemaOptions, that writes protobuf messages to writer in Avro binary format.
type SchemaOptions ¶ added in v0.6.0
type SchemaOptions struct {
OmitRootElement bool
}
SchemaOptions contains configuration options for Avro schema inference. OmitRootElement is used to determine whether the root element of a message should be omitted, when writing to Avro.
func (SchemaOptions) Encode ¶ added in v0.6.0
func (o SchemaOptions) Encode(message proto.Message) (interface{}, error)
Encode encodes the message.
func (SchemaOptions) InferSchema ¶ added in v0.6.0
func (o SchemaOptions) InferSchema(desc protoreflect.MessageDescriptor) (avro.Schema, error)
InferSchema returns the Avro schema for the protobuf message descriptor.
func (SchemaOptions) NewMarshaler ¶ added in v0.6.0
func (o SchemaOptions) NewMarshaler(descriptor protoreflect.MessageDescriptor, writer io.Writer) (*Marshaler, error)
NewMarshaler returns a new marshaler that writes protobuf messages to writer in Avro binary format.
func (SchemaOptions) NewUnmarshaler ¶ added in v0.6.0
func (o SchemaOptions) NewUnmarshaler(reader io.Reader) (*Unmarshaler, error)
NewUnmarshaler returns a new unmarshaler that reads protobuf messages from reader in Avro binary format.
type Unmarshaler ¶
type Unmarshaler struct {
// contains filtered or unexported fields
}
Unmarshaler reads and decodes Avro binary encoded messages.
func NewUnmarshaler ¶
func NewUnmarshaler(reader io.Reader) (*Unmarshaler, error)
NewUnmarshaler returns a new unmarshaler that reads protobuf messages from reader in Avro binary format.
func (*Unmarshaler) Scan ¶
func (m *Unmarshaler) Scan() bool
Scan returns true when there is at least one more message to be read. Scan should be called prior to calling Unmarshal.