avro

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 6 Imported by: 9

Documentation

Overview

Package avro provides a user functionality to return the avro encoding of s.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingNestedScema = errors.New("nested schema missing from parent")

ErrMissingNestedScema is returned when nested schemas are missing from the parent

View Source
var ErrUnsupportedFieldType = errors.New("unsupported field type")

ErrUnsupportedFieldType is returned for unsupported field types.

Functions

func ErrUnableToAssertType

func ErrUnableToAssertType(pErr interface{}) error

ErrUnableToAssertType is returned when the input value is not the expected type when applying type assertion to an interface

func ErrUnsupportedType

func ErrUnsupportedType(typ reflect.Kind) error

ErrUnsupportedType is returned if the interface isn't a pointer to a struct

Types

type Footballer

type Footballer struct {
	Email string `avro:"email"`
	Name  string `avro:"name"`
}

Footballer represents the details of a footballer

type FootballerName

type FootballerName struct {
	Surname  string            `avro:"surname"`
	Forename string            `avro:"forename"`
	AKA      map[string]string `avro:"aka"`
}

FootballerName represents an object containing the footballers name

type NestedTestData

type NestedTestData struct {
	Team       string            `avro:"team"`
	Footballer FootballerName    `avro:"footballer"`
	Stats      int32             `avro:"stats"`
	AKA        map[string]string `avro:"aka"`
	Silverware map[string]string `avro:"silverware"`
}

NestedTestData represents an object nested within an object

type Schema

type Schema struct {
	Definition string
}

Schema contains the schema definition necessary to generate an avro record

func (*Schema) Marshal

func (schema *Schema) Marshal(s interface{}) ([]byte, error)

Marshal is used to avro encode the interface of s.

func (*Schema) Unmarshal

func (schema *Schema) Unmarshal(message []byte, s interface{}) error

Unmarshal is used to parse the avro encoded data and store the result in the value pointed to by s.

Jump to

Keyboard shortcuts

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