Versions in this module Expand all Collapse all v0 v0.2.2 Jun 17, 2020 Changes in this version + const Array + const Boolean + const Bytes + const Double + const Enum + const Fixed + const Float + const Int + const Long + const Map + const Null + const Record + const Recursive + const String + const Union + var BlockNotFinished = errors.New("Block read is unfinished") + var EOF = errors.New("End of file reached") + var FieldDoesNotExist = errors.New("Field does not exist") + var IntOverflow = errors.New("Overflowed an int value") + var InvalidBool = errors.New("Invalid bool value") + var InvalidFixedSize = errors.New("Invalid Fixed type size") + var InvalidInt = errors.New("Invalid int value") + var InvalidLong = errors.New("Invalid long value") + var InvalidSchema = errors.New("Invalid schema") + var InvalidStringLength = errors.New("Invalid string length") + var InvalidSync = errors.New("Invalid sync") + var InvalidValueType = errors.New("Invalid array or map value type") + var LongOverflow = errors.New("Overflowed a long value") + var NegativeBytesLength = errors.New("Negative bytes length") + var NestedUnionsNotAllowed = errors.New("Nested unions are not allowed") + var NotAvroFile = errors.New("Not an Avro data file") + var SchemaNotSet = errors.New("Schema not set") + var UnionTypeOverflow = errors.New("Union type overflow") + func GetFullName(schema Schema) string + func LoadSchemas(path string) map[string]Schema + type ArraySchema struct + Items Schema + Properties map[string]interface{} + func (*ArraySchema) GetName() string + func (*ArraySchema) Type() int + func (s *ArraySchema) MarshalJSON() ([]byte, error) + func (s *ArraySchema) Prop(key string) (interface{}, bool) + func (s *ArraySchema) String() string + func (s *ArraySchema) Validate(v reflect.Value) bool + type AvroRecord interface + Schema func() Schema + type BinaryDecoder struct + func NewBinaryDecoder(buf []byte) *BinaryDecoder + func (bd *BinaryDecoder) ArrayNext() (int64, error) + func (bd *BinaryDecoder) MapNext() (int64, error) + func (bd *BinaryDecoder) ReadArrayStart() (int64, error) + func (bd *BinaryDecoder) ReadBoolean() (bool, error) + func (bd *BinaryDecoder) ReadBytes() ([]byte, error) + func (bd *BinaryDecoder) ReadDouble() (float64, error) + func (bd *BinaryDecoder) ReadEnum() (int32, error) + func (bd *BinaryDecoder) ReadFixed(bytes []byte) error + func (bd *BinaryDecoder) ReadFixedWithBounds(bytes []byte, start int, length int) error + func (bd *BinaryDecoder) ReadFloat() (float32, error) + func (bd *BinaryDecoder) ReadInt() (int32, error) + func (bd *BinaryDecoder) ReadLong() (int64, error) + func (bd *BinaryDecoder) ReadMapStart() (int64, error) + func (bd *BinaryDecoder) ReadNull() (interface{}, error) + func (bd *BinaryDecoder) ReadString() (string, error) + func (bd *BinaryDecoder) Seek(pos int64) + func (bd *BinaryDecoder) SetBlock(block *DataBlock) + func (bd *BinaryDecoder) Tell() int64 + type BinaryEncoder struct + func NewBinaryEncoder(buffer io.Writer) *BinaryEncoder + func (be *BinaryEncoder) WriteArrayNext(count int64) + func (be *BinaryEncoder) WriteArrayStart(count int64) + func (be *BinaryEncoder) WriteBoolean(x bool) + func (be *BinaryEncoder) WriteBytes(x []byte) + func (be *BinaryEncoder) WriteDouble(x float64) + func (be *BinaryEncoder) WriteFloat(x float32) + func (be *BinaryEncoder) WriteInt(x int32) + func (be *BinaryEncoder) WriteLong(x int64) + func (be *BinaryEncoder) WriteMapNext(count int64) + func (be *BinaryEncoder) WriteMapStart(count int64) + func (be *BinaryEncoder) WriteNull(_ interface{}) + func (be *BinaryEncoder) WriteRaw(x []byte) + func (be *BinaryEncoder) WriteString(x string) + type BooleanSchema struct + func (*BooleanSchema) GetName() string + func (*BooleanSchema) MarshalJSON() ([]byte, error) + func (*BooleanSchema) Prop(key string) (interface{}, bool) + func (*BooleanSchema) String() string + func (*BooleanSchema) Type() int + func (*BooleanSchema) Validate(v reflect.Value) bool + type BytesSchema struct + func (*BytesSchema) GetName() string + func (*BytesSchema) MarshalJSON() ([]byte, error) + func (*BytesSchema) Prop(key string) (interface{}, bool) + func (*BytesSchema) String() string + func (*BytesSchema) Type() int + func (*BytesSchema) Validate(v reflect.Value) bool + type CodeGenerator struct + func NewCodeGenerator(schemas []string) *CodeGenerator + func (codegen *CodeGenerator) Generate() (string, error) + type DataBlock struct + BlockRemaining int64 + BlockSize int + Data []byte + NumEntries int64 + type DataFileReader struct + func NewDataFileReader(filename string, datumReader DatumReader) (*DataFileReader, error) + func (reader *DataFileReader) Close() error + func (reader *DataFileReader) Next(v interface{}) (bool, error) + func (reader *DataFileReader) NextBlock() error + func (reader *DataFileReader) Seek(pos int64) + type DataFileWriter struct + func NewDataFileWriter(output io.Writer, schema Schema, datumWriter DatumWriter) (writer *DataFileWriter, err error) + func (w *DataFileWriter) Close() error + func (w *DataFileWriter) Flush() error + func (w *DataFileWriter) Write(v interface{}) error + type DatumReader interface + Read func(interface{}, Decoder) error + SetSchema func(Schema) + type DatumWriter interface + SetSchema func(Schema) + Write func(interface{}, Encoder) error + type Decoder interface + ArrayNext func() (int64, error) + MapNext func() (int64, error) + ReadArrayStart func() (int64, error) + ReadBoolean func() (bool, error) + ReadBytes func() ([]byte, error) + ReadDouble func() (float64, error) + ReadEnum func() (int32, error) + ReadFixed func([]byte) error + ReadFixedWithBounds func([]byte, int, int) error + ReadFloat func() (float32, error) + ReadInt func() (int32, error) + ReadLong func() (int64, error) + ReadMapStart func() (int64, error) + ReadNull func() (interface{}, error) + ReadString func() (string, error) + Seek func(int64) + SetBlock func(*DataBlock) + Tell func() int64 + type DoubleSchema struct + func (*DoubleSchema) GetName() string + func (*DoubleSchema) MarshalJSON() ([]byte, error) + func (*DoubleSchema) Prop(key string) (interface{}, bool) + func (*DoubleSchema) String() string + func (*DoubleSchema) Type() int + func (*DoubleSchema) Validate(v reflect.Value) bool + type Encoder interface + WriteArrayNext func(int64) + WriteArrayStart func(int64) + WriteBoolean func(bool) + WriteBytes func([]byte) + WriteDouble func(float64) + WriteFloat func(float32) + WriteInt func(int32) + WriteLong func(int64) + WriteMapNext func(int64) + WriteMapStart func(int64) + WriteNull func(interface{}) + WriteRaw func([]byte) + WriteString func(string) + type EnumSchema struct + Aliases []string + Doc string + Name string + Namespace string + Properties map[string]interface{} + Symbols []string + func (*EnumSchema) Type() int + func (*EnumSchema) Validate(v reflect.Value) bool + func (s *EnumSchema) GetName() string + func (s *EnumSchema) MarshalJSON() ([]byte, error) + func (s *EnumSchema) Prop(key string) (interface{}, bool) + func (s *EnumSchema) String() string + type FixedSchema struct + Name string + Namespace string + Properties map[string]interface{} + Size int + func (*FixedSchema) Type() int + func (s *FixedSchema) GetName() string + func (s *FixedSchema) MarshalJSON() ([]byte, error) + func (s *FixedSchema) Prop(key string) (interface{}, bool) + func (s *FixedSchema) String() string + func (s *FixedSchema) Validate(v reflect.Value) bool + type FloatSchema struct + func (*FloatSchema) GetName() string + func (*FloatSchema) MarshalJSON() ([]byte, error) + func (*FloatSchema) Prop(key string) (interface{}, bool) + func (*FloatSchema) String() string + func (*FloatSchema) Type() int + func (*FloatSchema) Validate(v reflect.Value) bool + type GenericDatumReader struct + func NewGenericDatumReader() *GenericDatumReader + func (reader *GenericDatumReader) Read(v interface{}, dec Decoder) error + func (reader *GenericDatumReader) SetSchema(schema Schema) + type GenericDatumWriter struct + func NewGenericDatumWriter() *GenericDatumWriter + func (writer *GenericDatumWriter) SetSchema(schema Schema) + func (writer *GenericDatumWriter) Write(obj interface{}, enc Encoder) error + type GenericEnum struct + Symbols []string + func NewGenericEnum(symbols []string) *GenericEnum + func (enum *GenericEnum) Get() string + func (enum *GenericEnum) GetIndex() int32 + func (enum *GenericEnum) Set(symbol string) + func (enum *GenericEnum) SetIndex(index int32) + type GenericRecord struct + func NewGenericRecord(schema Schema) *GenericRecord + func (gr *GenericRecord) Get(name string) interface{} + func (gr *GenericRecord) Map() map[string]interface{} + func (gr *GenericRecord) Schema() Schema + func (gr *GenericRecord) Set(name string, value interface{}) + func (gr *GenericRecord) String() string + type IntSchema struct + func (*IntSchema) GetName() string + func (*IntSchema) MarshalJSON() ([]byte, error) + func (*IntSchema) Prop(key string) (interface{}, bool) + func (*IntSchema) String() string + func (*IntSchema) Type() int + func (*IntSchema) Validate(v reflect.Value) bool + type LongSchema struct + func (*LongSchema) GetName() string + func (*LongSchema) MarshalJSON() ([]byte, error) + func (*LongSchema) Prop(key string) (interface{}, bool) + func (*LongSchema) String() string + func (*LongSchema) Type() int + func (*LongSchema) Validate(v reflect.Value) bool + type MapSchema struct + Properties map[string]interface{} + Values Schema + func (*MapSchema) GetName() string + func (*MapSchema) Type() int + func (s *MapSchema) MarshalJSON() ([]byte, error) + func (s *MapSchema) Prop(key string) (interface{}, bool) + func (s *MapSchema) String() string + func (s *MapSchema) Validate(v reflect.Value) bool + type NullSchema struct + func (*NullSchema) GetName() string + func (*NullSchema) MarshalJSON() ([]byte, error) + func (*NullSchema) Prop(key string) (interface{}, bool) + func (*NullSchema) String() string + func (*NullSchema) Type() int + func (*NullSchema) Validate(v reflect.Value) bool + type Reader interface + Read func(dec Decoder) error + type RecordSchema struct + Aliases []string + Doc string + Fields []*SchemaField + Name string + Namespace string + Properties map[string]interface{} + func (*RecordSchema) Type() int + func (s *RecordSchema) GetName() string + func (s *RecordSchema) MarshalJSON() ([]byte, error) + func (s *RecordSchema) Prop(key string) (interface{}, bool) + func (s *RecordSchema) String() string + func (s *RecordSchema) Validate(v reflect.Value) bool + type RecursiveSchema struct + Actual *RecordSchema + func (*RecursiveSchema) Prop(key string) (interface{}, bool) + func (*RecursiveSchema) Type() int + func (s *RecursiveSchema) GetName() string + func (s *RecursiveSchema) MarshalJSON() ([]byte, error) + func (s *RecursiveSchema) String() string + func (s *RecursiveSchema) Validate(v reflect.Value) bool + type Schema interface + GetName func() string + Prop func(key string) (interface{}, bool) + String func() string + Type func() int + Validate func(v reflect.Value) bool + func MustParseSchema(rawSchema string) Schema + func ParseSchema(rawSchema string) (Schema, error) + func ParseSchemaFile(file string) (Schema, error) + func ParseSchemaWithRegistry(rawSchema string, schemas map[string]Schema) (Schema, error) + func Prepare(schema Schema) Schema + func PrepareResolving(writer, reader Schema) Schema + type SchemaField struct + Default interface{} + Doc string + Name string + Properties map[string]interface{} + Type Schema + func (s *SchemaField) MarshalJSON() ([]byte, error) + func (s *SchemaField) String() string + func (this *SchemaField) Prop(key string) (interface{}, bool) + type SpecificDatumReader struct + func NewSpecificDatumReader() *SpecificDatumReader + func (reader *SpecificDatumReader) Read(v interface{}, dec Decoder) error + func (reader *SpecificDatumReader) SetSchema(schema Schema) + type SpecificDatumWriter struct + func NewSpecificDatumWriter() *SpecificDatumWriter + func (writer *SpecificDatumWriter) SetSchema(schema Schema) + func (writer *SpecificDatumWriter) Write(obj interface{}, enc Encoder) error + type StringSchema struct + func (*StringSchema) GetName() string + func (*StringSchema) MarshalJSON() ([]byte, error) + func (*StringSchema) Prop(key string) (interface{}, bool) + func (*StringSchema) String() string + func (*StringSchema) Type() int + func (*StringSchema) Validate(v reflect.Value) bool + type UnionSchema struct + Types []Schema + func (*UnionSchema) GetName() string + func (*UnionSchema) Prop(key string) (interface{}, bool) + func (*UnionSchema) Type() int + func (s *UnionSchema) GetType(v reflect.Value) int + func (s *UnionSchema) MarshalJSON() ([]byte, error) + func (s *UnionSchema) String() string + func (s *UnionSchema) Validate(v reflect.Value) bool + type Writer interface + Write func(enc Encoder) error