Documentation ¶
Index ¶
- Constants
- Variables
- type ArraySchema
- type BinaryDecoder
- func (this *BinaryDecoder) ArrayNext() (int64, error)
- func (this *BinaryDecoder) MapNext() (int64, error)
- func (this *BinaryDecoder) ReadArrayStart() (int64, error)
- func (this *BinaryDecoder) ReadBoolean() (bool, error)
- func (this *BinaryDecoder) ReadBytes() ([]byte, error)
- func (this *BinaryDecoder) ReadDouble() (float64, error)
- func (this *BinaryDecoder) ReadEnum() (int32, error)
- func (this *BinaryDecoder) ReadFixed(bytes []byte) error
- func (this *BinaryDecoder) ReadFixedWithBounds(bytes []byte, start int, length int) error
- func (this *BinaryDecoder) ReadFloat() (float32, error)
- func (this *BinaryDecoder) ReadInt() (int32, error)
- func (this *BinaryDecoder) ReadLong() (int64, error)
- func (this *BinaryDecoder) ReadMapStart() (int64, error)
- func (this *BinaryDecoder) ReadNull() (interface{}, error)
- func (this *BinaryDecoder) ReadString() (string, error)
- func (this *BinaryDecoder) Seek(pos int64)
- func (this *BinaryDecoder) SetBlock(block *DataBlock)
- func (this *BinaryDecoder) Tell() int64
- type BinaryEncoder
- func (this *BinaryEncoder) WriteArrayNext(count int64)
- func (this *BinaryEncoder) WriteArrayStart(count int64)
- func (this *BinaryEncoder) WriteBoolean(x bool)
- func (this *BinaryEncoder) WriteBytes(x []byte)
- func (this *BinaryEncoder) WriteDouble(x float64)
- func (this *BinaryEncoder) WriteFloat(x float32)
- func (this *BinaryEncoder) WriteInt(x int32)
- func (this *BinaryEncoder) WriteLong(x int64)
- func (this *BinaryEncoder) WriteMapNext(count int64)
- func (this *BinaryEncoder) WriteMapStart(count int64)
- func (this *BinaryEncoder) WriteNull(_ interface{})
- func (this *BinaryEncoder) WriteString(x string)
- type BooleanSchema
- type BytesSchema
- type DataBlock
- type DataFileReader
- type DatumReader
- type DatumWriter
- type Decoder
- type DoubleSchema
- type Encoder
- type EnumSchema
- type FixedSchema
- type FloatSchema
- type GenericDatumReader
- type GenericDatumWriter
- type GenericEnum
- type GenericRecord
- type IntSchema
- type LongSchema
- type MapSchema
- type NullSchema
- type RecordSchema
- type Schema
- type SchemaField
- type SpecificDatumReader
- type SpecificDatumWriter
- type StringSchema
- type UnionSchema
Constants ¶
const ( Record int = iota Enum Array Map Union Fixed String Bytes Int Long Float Double Boolean Null )
Variables ¶
var BlockNotFinished = errors.New("Block read is unfinished")
happens when trying to read next block without finishing the previous one
var CODEC_KEY = "avro.codec"
var EOF = errors.New("End of file reached")
signals that an end of file or stream has been reached unexpectedly
var IntOverflow = errors.New("Overflowed an int value")
happens when the given value to decode overflows maximum int32 value
var InvalidBool = errors.New("Invalid bool value")
happens when given value to decode as bool is neither 0x00 nor 0x01
var InvalidFixedSize = errors.New("Invalid Fixed type size")
happens when avro schema contains invalid value for fixed size
var InvalidSchema = errors.New("Invalid schema")
happens when avro schema is unparsable or is invalid in any other way
var InvalidStringLength = errors.New("Invalid string length")
happens when given value to decode as string has either negative or undecodable length
var InvalidSync = errors.New("Invalid sync")
happens when file header's sync and block's sync do not match - indicates corrupted data
var InvalidValueType = errors.New("Invalid array or map value type")
happens when avro schema contains invalid value for map value type or array item type
var LongOverflow = errors.New("Overflowed a long value")
happens when the given value to decode overflows maximum int64 value
var MAGIC []byte = []byte{'O', 'b', 'j', VERSION}
var NegativeBytesLength = errors.New("Negative bytes length")
happens when given value to decode as bytes has negative length
var NestedUnionsNotAllowed = errors.New("Nested unions are not allowed")
happens when avro schema contains a union within union
var NotAvroFile = errors.New("Not an Avro data file")
indicates the given file to decode does not correspond to Avro data file format
var SCHEMA_KEY = "avro.schema"
var SYNC_SIZE = 16
var SchemaNotSet = errors.New("Schema not set")
happens when a datum reader has no set schema
var VERSION byte = 1
Functions ¶
This section is empty.
Types ¶
type ArraySchema ¶
type ArraySchema struct {
Items Schema
}
func (*ArraySchema) GetName ¶
func (*ArraySchema) GetName() string
func (*ArraySchema) MarshalJSON ¶
func (this *ArraySchema) MarshalJSON() ([]byte, error)
func (*ArraySchema) String ¶
func (this *ArraySchema) String() string
func (*ArraySchema) Type ¶
func (*ArraySchema) Type() int
type BinaryDecoder ¶
type BinaryDecoder struct {
// contains filtered or unexported fields
}
func NewBinaryDecoder ¶
func NewBinaryDecoder(buf []byte) *BinaryDecoder
func (*BinaryDecoder) ArrayNext ¶
func (this *BinaryDecoder) ArrayNext() (int64, error)
func (*BinaryDecoder) MapNext ¶
func (this *BinaryDecoder) MapNext() (int64, error)
func (*BinaryDecoder) ReadArrayStart ¶
func (this *BinaryDecoder) ReadArrayStart() (int64, error)
func (*BinaryDecoder) ReadBoolean ¶
func (this *BinaryDecoder) ReadBoolean() (bool, error)
func (*BinaryDecoder) ReadBytes ¶
func (this *BinaryDecoder) ReadBytes() ([]byte, error)
func (*BinaryDecoder) ReadDouble ¶
func (this *BinaryDecoder) ReadDouble() (float64, error)
func (*BinaryDecoder) ReadEnum ¶
func (this *BinaryDecoder) ReadEnum() (int32, error)
func (*BinaryDecoder) ReadFixed ¶
func (this *BinaryDecoder) ReadFixed(bytes []byte) error
func (*BinaryDecoder) ReadFixedWithBounds ¶
func (this *BinaryDecoder) ReadFixedWithBounds(bytes []byte, start int, length int) error
func (*BinaryDecoder) ReadFloat ¶
func (this *BinaryDecoder) ReadFloat() (float32, error)
func (*BinaryDecoder) ReadInt ¶
func (this *BinaryDecoder) ReadInt() (int32, error)
func (*BinaryDecoder) ReadLong ¶
func (this *BinaryDecoder) ReadLong() (int64, error)
func (*BinaryDecoder) ReadMapStart ¶
func (this *BinaryDecoder) ReadMapStart() (int64, error)
func (*BinaryDecoder) ReadNull ¶
func (this *BinaryDecoder) ReadNull() (interface{}, error)
func (*BinaryDecoder) ReadString ¶
func (this *BinaryDecoder) ReadString() (string, error)
func (*BinaryDecoder) Seek ¶
func (this *BinaryDecoder) Seek(pos int64)
func (*BinaryDecoder) SetBlock ¶
func (this *BinaryDecoder) SetBlock(block *DataBlock)
func (*BinaryDecoder) Tell ¶
func (this *BinaryDecoder) Tell() int64
type BinaryEncoder ¶
type BinaryEncoder struct {
// contains filtered or unexported fields
}
func NewBinaryEncoder ¶
func NewBinaryEncoder(buffer *bytes.Buffer) *BinaryEncoder
func (*BinaryEncoder) WriteArrayNext ¶
func (this *BinaryEncoder) WriteArrayNext(count int64)
func (*BinaryEncoder) WriteArrayStart ¶
func (this *BinaryEncoder) WriteArrayStart(count int64)
func (*BinaryEncoder) WriteBoolean ¶
func (this *BinaryEncoder) WriteBoolean(x bool)
func (*BinaryEncoder) WriteBytes ¶
func (this *BinaryEncoder) WriteBytes(x []byte)
func (*BinaryEncoder) WriteDouble ¶
func (this *BinaryEncoder) WriteDouble(x float64)
func (*BinaryEncoder) WriteFloat ¶
func (this *BinaryEncoder) WriteFloat(x float32)
func (*BinaryEncoder) WriteInt ¶
func (this *BinaryEncoder) WriteInt(x int32)
func (*BinaryEncoder) WriteLong ¶
func (this *BinaryEncoder) WriteLong(x int64)
func (*BinaryEncoder) WriteMapNext ¶
func (this *BinaryEncoder) WriteMapNext(count int64)
func (*BinaryEncoder) WriteMapStart ¶
func (this *BinaryEncoder) WriteMapStart(count int64)
func (*BinaryEncoder) WriteNull ¶
func (this *BinaryEncoder) WriteNull(_ interface{})
func (*BinaryEncoder) WriteString ¶
func (this *BinaryEncoder) WriteString(x string)
type BooleanSchema ¶
type BooleanSchema struct{}
func (*BooleanSchema) GetName ¶
func (*BooleanSchema) GetName() string
func (*BooleanSchema) MarshalJSON ¶
func (this *BooleanSchema) MarshalJSON() ([]byte, error)
func (*BooleanSchema) String ¶
func (*BooleanSchema) String() string
func (*BooleanSchema) Type ¶
func (*BooleanSchema) Type() int
type BytesSchema ¶
type BytesSchema struct{}
func (*BytesSchema) GetName ¶
func (*BytesSchema) GetName() string
func (*BytesSchema) MarshalJSON ¶
func (this *BytesSchema) MarshalJSON() ([]byte, error)
func (*BytesSchema) String ¶
func (*BytesSchema) String() string
func (*BytesSchema) Type ¶
func (*BytesSchema) Type() int
type DataFileReader ¶
type DataFileReader struct {
// contains filtered or unexported fields
}
func NewDataFileReader ¶
func NewDataFileReader(filename string, datumReader DatumReader) (*DataFileReader, error)
func (*DataFileReader) Next ¶
func (this *DataFileReader) Next(v interface{}) (bool, error)
func (*DataFileReader) NextBlock ¶
func (this *DataFileReader) NextBlock() error
func (*DataFileReader) Seek ¶
func (this *DataFileReader) Seek(pos int64)
type DatumReader ¶
type DatumWriter ¶
type Decoder ¶
type Decoder interface { ReadNull() (interface{}, error) ReadBoolean() (bool, error) ReadInt() (int32, error) ReadLong() (int64, error) ReadFloat() (float32, error) ReadDouble() (float64, error) ReadBytes() ([]byte, error) ReadString() (string, error) ReadEnum() (int32, error) ReadArrayStart() (int64, error) ArrayNext() (int64, error) ReadMapStart() (int64, error) MapNext() (int64, error) ReadFixed([]byte) error ReadFixedWithBounds([]byte, int, int) error SetBlock(*DataBlock) Seek(int64) Tell() int64 }
type DoubleSchema ¶
type DoubleSchema struct{}
func (*DoubleSchema) GetName ¶
func (*DoubleSchema) GetName() string
func (*DoubleSchema) MarshalJSON ¶
func (this *DoubleSchema) MarshalJSON() ([]byte, error)
func (*DoubleSchema) String ¶
func (*DoubleSchema) String() string
func (*DoubleSchema) Type ¶
func (*DoubleSchema) Type() int
type EnumSchema ¶
type EnumSchema struct { Name string Namespace string Aliases []string Doc string Symbols []string }
func (*EnumSchema) GetName ¶
func (this *EnumSchema) GetName() string
func (*EnumSchema) MarshalJSON ¶
func (this *EnumSchema) MarshalJSON() ([]byte, error)
func (*EnumSchema) String ¶
func (this *EnumSchema) String() string
func (*EnumSchema) Type ¶
func (*EnumSchema) Type() int
type FixedSchema ¶
func (*FixedSchema) GetName ¶
func (this *FixedSchema) GetName() string
func (*FixedSchema) MarshalJSON ¶
func (this *FixedSchema) MarshalJSON() ([]byte, error)
func (*FixedSchema) String ¶
func (this *FixedSchema) String() string
func (*FixedSchema) Type ¶
func (*FixedSchema) Type() int
type FloatSchema ¶
type FloatSchema struct{}
func (*FloatSchema) GetName ¶
func (*FloatSchema) GetName() string
func (*FloatSchema) MarshalJSON ¶
func (this *FloatSchema) MarshalJSON() ([]byte, error)
func (*FloatSchema) String ¶
func (*FloatSchema) String() string
func (*FloatSchema) Type ¶
func (*FloatSchema) Type() int
type GenericDatumReader ¶
type GenericDatumReader struct {
// contains filtered or unexported fields
}
func NewGenericDatumReader ¶
func NewGenericDatumReader() *GenericDatumReader
func (*GenericDatumReader) Read ¶
func (this *GenericDatumReader) Read(v interface{}, dec Decoder) (interface{}, error)
func (*GenericDatumReader) SetSchema ¶
func (this *GenericDatumReader) SetSchema(schema Schema)
type GenericDatumWriter ¶
type GenericDatumWriter struct {
// contains filtered or unexported fields
}
func NewGenericDatumWriter ¶
func NewGenericDatumWriter() *GenericDatumWriter
func (*GenericDatumWriter) SetSchema ¶
func (this *GenericDatumWriter) SetSchema(schema Schema)
func (*GenericDatumWriter) Write ¶
func (this *GenericDatumWriter) Write(obj interface{}, enc Encoder) error
type GenericEnum ¶
type GenericEnum struct { Symbols []string // contains filtered or unexported fields }
func (*GenericEnum) Get ¶
func (this *GenericEnum) Get() string
type GenericRecord ¶
type GenericRecord struct {
// contains filtered or unexported fields
}
func NewGenericRecord ¶
func NewGenericRecord(schema Schema) *GenericRecord
func (*GenericRecord) Get ¶
func (this *GenericRecord) Get(name string) interface{}
func (*GenericRecord) Schema ¶
func (this *GenericRecord) Schema() Schema
func (*GenericRecord) Set ¶
func (this *GenericRecord) Set(name string, value interface{})
type LongSchema ¶
type LongSchema struct{}
func (*LongSchema) GetName ¶
func (*LongSchema) GetName() string
func (*LongSchema) MarshalJSON ¶
func (this *LongSchema) MarshalJSON() ([]byte, error)
func (*LongSchema) String ¶
func (*LongSchema) String() string
func (*LongSchema) Type ¶
func (*LongSchema) Type() int
type NullSchema ¶
type NullSchema struct{}
func (*NullSchema) GetName ¶
func (*NullSchema) GetName() string
func (*NullSchema) MarshalJSON ¶
func (this *NullSchema) MarshalJSON() ([]byte, error)
func (*NullSchema) String ¶
func (*NullSchema) String() string
func (*NullSchema) Type ¶
func (*NullSchema) Type() int
type RecordSchema ¶
type RecordSchema struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Doc string `json:"doc,omitempty"` Aliases []string `json:"aliases,omitempty"` Fields []*SchemaField `json:"fields,omitempty"` }
COMPLEX
func (*RecordSchema) GetName ¶
func (this *RecordSchema) GetName() string
func (*RecordSchema) MarshalJSON ¶
func (this *RecordSchema) MarshalJSON() ([]byte, error)
func (*RecordSchema) String ¶
func (this *RecordSchema) String() string
func (*RecordSchema) Type ¶
func (*RecordSchema) Type() int
type Schema ¶
func ParseSchema ¶
type SchemaField ¶
type SchemaField struct { Name string `json:"name,omitempty"` Doc string `json:"doc,omitempty"` Default interface{} `json:"default,omitempty"` Type Schema `json:"type,omitempty"` }
func (*SchemaField) String ¶
func (this *SchemaField) String() string
type SpecificDatumReader ¶
type SpecificDatumReader struct {
// contains filtered or unexported fields
}
func NewSpecificDatumReader ¶
func NewSpecificDatumReader() *SpecificDatumReader
func (*SpecificDatumReader) Read ¶
func (this *SpecificDatumReader) Read(v interface{}, dec Decoder) (interface{}, error)
func (*SpecificDatumReader) SetSchema ¶
func (this *SpecificDatumReader) SetSchema(schema Schema)
type SpecificDatumWriter ¶
type SpecificDatumWriter struct {
// contains filtered or unexported fields
}
func NewSpecificDatumWriter ¶
func NewSpecificDatumWriter() *SpecificDatumWriter
func (*SpecificDatumWriter) SetSchema ¶
func (this *SpecificDatumWriter) SetSchema(schema Schema)
func (*SpecificDatumWriter) Write ¶
func (this *SpecificDatumWriter) Write(obj interface{}, enc Encoder) error
type StringSchema ¶
type StringSchema struct{}
PRIMITIVES
func (*StringSchema) GetName ¶
func (*StringSchema) GetName() string
func (*StringSchema) MarshalJSON ¶
func (this *StringSchema) MarshalJSON() ([]byte, error)
func (*StringSchema) String ¶
func (*StringSchema) String() string
func (*StringSchema) Type ¶
func (*StringSchema) Type() int
type UnionSchema ¶
type UnionSchema struct {
Types []Schema
}
func (*UnionSchema) GetName ¶
func (*UnionSchema) GetName() string
func (*UnionSchema) MarshalJSON ¶
func (this *UnionSchema) MarshalJSON() ([]byte, error)
func (*UnionSchema) String ¶
func (this *UnionSchema) String() string
func (*UnionSchema) Type ¶
func (*UnionSchema) Type() int