Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAvroName ¶
func ParseAvroName(enclosing, name string) avro.QualifiedName
ParseAvroName parses a name according to the Avro spec:
- If the name contains a dot ('.'), the last part is the name and the rest is the namespace
- Otherwise, the enclosing namespace is used
Types ¶
type Namespace ¶
type Namespace struct { Definitions map[avro.QualifiedName]avro.Definition Roots []avro.Definition ShortUnions bool }
Namespace is a mapping of avro.QualifiedNames to their Definitions, used to resolve type lookups within a schema.
func NewNamespace ¶
func (*Namespace) RegisterDefinition ¶
func (n *Namespace) RegisterDefinition(d avro.Definition) error
RegisterDefinition adds a new type definition to the namespace. Returns an error if the type is already defined.
func (*Namespace) TypeForSchema ¶
TypeForSchema accepts an Avro schema as a JSON string, decode it and return the AvroType defined at the top level:
- a single record definition (JSON map)
- a union of multiple types (JSON array)
- an already-defined type (JSON string)
The Avro type defined at the top level and all the type definitions beneath it will also be added to this Namespace.
type RequiredMapKeyError ¶
type RequiredMapKeyError struct {
Key string
}
func NewRequiredMapKeyError ¶
func NewRequiredMapKeyError(key string) *RequiredMapKeyError
func (*RequiredMapKeyError) Error ¶
func (r *RequiredMapKeyError) Error() string
type SchemaError ¶
func NewSchemaError ¶
func NewSchemaError(fieldName string, err error) *SchemaError
func (*SchemaError) Error ¶
func (s *SchemaError) Error() string
type WrongMapValueTypeError ¶
func NewWrongMapValueTypeError ¶
func NewWrongMapValueTypeError(key, expectedType string, actualValue interface{}) *WrongMapValueTypeError
func (*WrongMapValueTypeError) Error ¶
func (w *WrongMapValueTypeError) Error() string
Click to show internal directories.
Click to hide internal directories.