avro

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadOnlyModeEnabled = errors.New("read only mode enabled")
)

Functions

func NewAPI added in v0.0.3

func NewAPI() avro.API

func NewCompatibilityAPI added in v0.0.3

func NewCompatibilityAPI() *avro.SchemaCompatibility

func NewFSRegistry added in v0.0.3

func NewFSRegistry(f fs.FS, dir string) *avro_registry.Registry

func NewGlueRegistry added in v0.0.3

func NewGlueRegistry(registryName string, client avro_glue.ClientAPI) *avro_registry.Registry

func UnpackEventSchemas added in v0.0.3

func UnpackEventSchemas(schema *avro.RecordSchema) ([]*avro.RecordSchema, error)

UnpackEventSchemas expects to receive the schema of the event envelope and returns the wrapped event types' schemas.

It fails if the given schema type and sub-types are not as expected

Types

type EventSerializer

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

func NewEventSerializer

func NewEventSerializer(ctx context.Context, r *registry.Registry, opts ...func(*EventSerializerConfig)) *EventSerializer

func (*EventSerializer) MarshalEvent

func (s *EventSerializer) MarshalEvent(ctx context.Context, evt event.Envelope) (b []byte, err error)

MarshalEvent implements event.Serializer.

func (*EventSerializer) MarshalEventBatch

func (s *EventSerializer) MarshalEventBatch(ctx context.Context, events []event.Envelope) (b []byte, err error)

MarshalEventBatch implements event.Serializer. Note event size per item n []int is not supported at the moment

func (*EventSerializer) UnmarshalEvent

func (s *EventSerializer) UnmarshalEvent(ctx context.Context, b []byte) (event.Envelope, error)

UnmarshalEvent implements event.Serializer.

func (*EventSerializer) UnmarshalEventBatch

func (s *EventSerializer) UnmarshalEventBatch(ctx context.Context, b []byte) ([]event.Envelope, error)

UnmarshalEventBatch implements event.Serializer.

type EventSerializerConfig

type EventSerializerConfig struct {
	ReadOnly  bool
	Namespace string
	// SkipCurrentSchema disables the generation of the current schema from registered event.
	SkipCurrentSchema    bool
	PersistCurrentSchema bool
}

type SchemaMap added in v0.0.3

type SchemaMap map[string]avro.Schema

func EventSchemas added in v0.0.3

func EventSchemas(a avro.API, namespaces []string) (SchemaMap, error)

EventSchemas generate schema for each given namespace or all the registered namespace in the event registry. It returns a map of schemas where the key is the namespace.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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