schema

package
v0.0.0-...-0bb0fe6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveMagicHeader

func RemoveMagicHeader(reader io.Reader) error

RemoveMagicHeader reads the five bytes from the reader to remove the magic header.

Types

type Avro

type Avro interface {
	Serialize(w io.Writer) error
	Schema() string
}

Avro contains data and schema.

type AvroEncoder

type AvroEncoder struct {
	SchemaId uint32
	Content  []byte
}

AvroEncoder encodes schemaId and Avro message.

func (*AvroEncoder) Encode

func (a *AvroEncoder) Encode() ([]byte, error)

Encode configured schemaId and Avro content into bytes.

func (*AvroEncoder) Length

func (a *AvroEncoder) Length() int

Length of schemaId and Content.

type AvroEncoderBuilder

type AvroEncoderBuilder interface {
	BuildEncoder(subject string, avro Avro) (sarama.Encoder, error)
}

AvroEncoderBuilder create a sarama.Encoder for the given Avro object and subject.

func NewAvroEncoderBuilder

func NewAvroEncoderBuilder(
	schemaRegistry Registry,
) AvroEncoderBuilder

NewAvroSchemaEncoderBuilder returns a AvroEncoderBuilder.

type Registry

type Registry interface {
	// SchemaId return the id for the given schema json.
	SchemaId(subject string, schema string) (uint32, error)
}

Registry gets the schemaId from the schema registry.

func NewRegistry

func NewRegistry(httpClient *http.Client, schemaRegistryURL string) Registry

NewRegistry create a Registry with the given HttpClient and URL

Jump to

Keyboard shortcuts

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