Documentation ¶
Index ¶
- Constants
- type Definition
- type EnumDefinition
- func (e *EnumDefinition) AddDeserializer(p *generator.Package)
- func (e *EnumDefinition) AddSerializer(p *generator.Package)
- func (e *EnumDefinition) AddStruct(p *generator.Package)
- func (e *EnumDefinition) Aliases() []QualifiedName
- func (e *EnumDefinition) AvroName() QualifiedName
- func (e *EnumDefinition) DeserializerMethod() string
- func (e *EnumDefinition) FieldType() string
- func (e *EnumDefinition) GoType() string
- func (s *EnumDefinition) ResolveReferences(n *Namespace) error
- func (s *EnumDefinition) Schema(names map[QualifiedName]interface{}) interface{}
- func (e *EnumDefinition) SerializerMethod() string
- type Field
- type FixedDefinition
- func (s *FixedDefinition) AddDeserializer(p *generator.Package)
- func (s *FixedDefinition) AddSerializer(p *generator.Package)
- func (s *FixedDefinition) AddStruct(p *generator.Package)
- func (s *FixedDefinition) Aliases() []QualifiedName
- func (s *FixedDefinition) AvroName() QualifiedName
- func (s *FixedDefinition) DeserializerMethod() string
- func (s *FixedDefinition) FieldType() string
- func (s *FixedDefinition) GoType() string
- func (s *FixedDefinition) ResolveReferences(n *Namespace) error
- func (s *FixedDefinition) Schema(names map[QualifiedName]interface{}) interface{}
- func (s *FixedDefinition) SerializerMethod() string
- type Namespace
- type PrimitiveType
- type QualifiedName
- type RecordDefinition
- func (r *RecordDefinition) AddDeserializer(p *generator.Package)
- func (r *RecordDefinition) AddSerializer(p *generator.Package)
- func (r *RecordDefinition) AddStruct(p *generator.Package)
- func (r *RecordDefinition) Aliases() []QualifiedName
- func (r *RecordDefinition) AvroName() QualifiedName
- func (r *RecordDefinition) DeserializerMethod() string
- func (r *RecordDefinition) FieldType() string
- func (r *RecordDefinition) GoType() string
- func (r *RecordDefinition) ResolveReferences(n *Namespace) error
- func (r *RecordDefinition) Schema(names map[QualifiedName]interface{}) interface{}
- func (r *RecordDefinition) SerializerMethod() string
- type Reference
- func (s *Reference) AddDeserializer(p *generator.Package)
- func (s *Reference) AddSerializer(p *generator.Package)
- func (s *Reference) AddStruct(p *generator.Package)
- func (s *Reference) AvroName() string
- func (s *Reference) Default() interface{}
- func (s *Reference) Definition() Definition
- func (s *Reference) DeserializerMethod() string
- func (s *Reference) FieldType() string
- func (s *Reference) GoName() string
- func (s *Reference) GoType() string
- func (s *Reference) HasDefault() bool
- func (s *Reference) ResolveReferences(n *Namespace) error
- func (s *Reference) Schema(names map[QualifiedName]interface{}) interface{}
- func (s *Reference) SerializerMethod() string
- type RequiredMapKeyError
- type Schema
- type SchemaError
- type WrongMapValueTypeError
Constants ¶
View Source
const UTIL_FILE = "primitive.go"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition interface { AvroName() QualifiedName Aliases() []QualifiedName // The friendly name for the type FieldType() string // The corresponding Go type GoType() string // The name of the method which writes this field onto the wire SerializerMethod() string // The name of the method which reads this field off the wire DeserializerMethod() string // Add the imports and struct for the definition of this type to the generator.Package AddStruct(*generator.Package) // Add the imports, methods and structs required for the serializer to the generator.Package AddSerializer(*generator.Package) // Add the imports, methods and structs required for the deserializer to the generator.Package AddDeserializer(*generator.Package) ResolveReferences(*Namespace) error Schema(names map[QualifiedName]interface{}) interface{} }
type EnumDefinition ¶
type EnumDefinition struct {
// contains filtered or unexported fields
}
func (*EnumDefinition) AddDeserializer ¶
func (e *EnumDefinition) AddDeserializer(p *generator.Package)
func (*EnumDefinition) AddSerializer ¶
func (e *EnumDefinition) AddSerializer(p *generator.Package)
func (*EnumDefinition) AddStruct ¶
func (e *EnumDefinition) AddStruct(p *generator.Package)
func (*EnumDefinition) Aliases ¶
func (e *EnumDefinition) Aliases() []QualifiedName
func (*EnumDefinition) AvroName ¶
func (e *EnumDefinition) AvroName() QualifiedName
func (*EnumDefinition) DeserializerMethod ¶
func (e *EnumDefinition) DeserializerMethod() string
func (*EnumDefinition) FieldType ¶
func (e *EnumDefinition) FieldType() string
func (*EnumDefinition) GoType ¶
func (e *EnumDefinition) GoType() string
func (*EnumDefinition) ResolveReferences ¶
func (s *EnumDefinition) ResolveReferences(n *Namespace) error
func (*EnumDefinition) Schema ¶
func (s *EnumDefinition) Schema(names map[QualifiedName]interface{}) interface{}
func (*EnumDefinition) SerializerMethod ¶
func (e *EnumDefinition) SerializerMethod() string
type Field ¶
type Field interface { // The field name in the schema definition AvroName() string // The field name in the Go struct GoName() string // The friendly type name FieldType() string // Default value for the field HasDefault() bool Default() interface{} // The corresponding Go type GoType() string // The name of the method which writes this field onto the wire SerializerMethod() string // The name of the method which reads this field off the wire DeserializerMethod() string // Add the imports and struct for the definition of this type to the generator.Package AddStruct(*generator.Package) // Add the imports, methods and structs required for the serializer to the generator.Package AddSerializer(*generator.Package) // Add the imports, methods and structs required for the deserializer to the generator.Package AddDeserializer(*generator.Package) // Attempt to resolve references to named structs, enums or fixed fields ResolveReferences(*Namespace) error // Get the objects that will serialize to the normalized JSON schema Schema(names map[QualifiedName]interface{}) interface{} }
* The interface implemented by all Avro field types.
type FixedDefinition ¶
type FixedDefinition struct {
// contains filtered or unexported fields
}
func (*FixedDefinition) AddDeserializer ¶
func (s *FixedDefinition) AddDeserializer(p *generator.Package)
func (*FixedDefinition) AddSerializer ¶
func (s *FixedDefinition) AddSerializer(p *generator.Package)
func (*FixedDefinition) AddStruct ¶
func (s *FixedDefinition) AddStruct(p *generator.Package)
func (*FixedDefinition) Aliases ¶
func (s *FixedDefinition) Aliases() []QualifiedName
func (*FixedDefinition) AvroName ¶
func (s *FixedDefinition) AvroName() QualifiedName
func (*FixedDefinition) DeserializerMethod ¶
func (s *FixedDefinition) DeserializerMethod() string
func (*FixedDefinition) FieldType ¶
func (s *FixedDefinition) FieldType() string
func (*FixedDefinition) GoType ¶
func (s *FixedDefinition) GoType() string
func (*FixedDefinition) ResolveReferences ¶
func (s *FixedDefinition) ResolveReferences(n *Namespace) error
func (*FixedDefinition) Schema ¶
func (s *FixedDefinition) Schema(names map[QualifiedName]interface{}) interface{}
func (*FixedDefinition) SerializerMethod ¶
func (s *FixedDefinition) SerializerMethod() string
type Namespace ¶
type Namespace struct { Definitions map[QualifiedName]Definition Schemas []Schema }
Namespace is a mapping of QualifiedNames to their Definitions, used to resolve type lookups within a schema.
func NewNamespace ¶
func NewNamespace() *Namespace
func (*Namespace) FieldDefinitionForSchema ¶
Given an Avro schema as a JSON string, decode it and return the Field 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 Field defined at the top level and all the type definitions beneath it will also be added to this Namespace.
func (*Namespace) RegisterDefinition ¶
func (n *Namespace) RegisterDefinition(d Definition) error
Add a new type definition to the namespace. Returns an error if the type is already defined.
type PrimitiveType ¶
type QualifiedName ¶
An Avro qualified name, which includes an optional namespace and the type name.
func ParseAvroName ¶
func ParseAvroName(enclosing, name string) QualifiedName
Parse 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
func (QualifiedName) String ¶
func (q QualifiedName) String() string
type RecordDefinition ¶
type RecordDefinition struct {
// contains filtered or unexported fields
}
func (*RecordDefinition) AddDeserializer ¶
func (r *RecordDefinition) AddDeserializer(p *generator.Package)
func (*RecordDefinition) AddSerializer ¶
func (r *RecordDefinition) AddSerializer(p *generator.Package)
func (*RecordDefinition) AddStruct ¶
func (r *RecordDefinition) AddStruct(p *generator.Package)
func (*RecordDefinition) Aliases ¶
func (r *RecordDefinition) Aliases() []QualifiedName
func (*RecordDefinition) AvroName ¶
func (r *RecordDefinition) AvroName() QualifiedName
func (*RecordDefinition) DeserializerMethod ¶
func (r *RecordDefinition) DeserializerMethod() string
func (*RecordDefinition) FieldType ¶
func (r *RecordDefinition) FieldType() string
func (*RecordDefinition) GoType ¶
func (r *RecordDefinition) GoType() string
func (*RecordDefinition) ResolveReferences ¶
func (r *RecordDefinition) ResolveReferences(n *Namespace) error
func (*RecordDefinition) Schema ¶
func (r *RecordDefinition) Schema(names map[QualifiedName]interface{}) interface{}
func (*RecordDefinition) SerializerMethod ¶
func (r *RecordDefinition) SerializerMethod() string
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
func (*Reference) AddDeserializer ¶
func (*Reference) AddSerializer ¶
func (*Reference) Definition ¶
func (s *Reference) Definition() Definition
func (*Reference) DeserializerMethod ¶
func (*Reference) HasDefault ¶
func (*Reference) ResolveReferences ¶
func (*Reference) Schema ¶
func (s *Reference) Schema(names map[QualifiedName]interface{}) interface{}
func (*Reference) SerializerMethod ¶
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.