Versions in this module Expand all Collapse all v1 v1.6.99 Apr 20, 2022 Changes in this version + var DefaultConfig = Config{}.Freeze() + var DefaultSchemaCache = &SchemaCache + var NoDefault = noDef + func Marshal(schema Schema, v interface{}) ([]byte, error) + func Register(name string, obj interface{}) + func Unmarshal(schema Schema, data []byte, v interface{}) error + type API interface + DecoderOf func(schema Schema, typ reflect2.Type) ValDecoder + EncoderOf func(schema Schema, tpy reflect2.Type) ValEncoder + Marshal func(schema Schema, v interface{}) ([]byte, error) + NewDecoder func(schema Schema, r io.Reader) *Decoder + NewEncoder func(schema Schema, w io.Writer) *Encoder + Register func(name string, obj interface{}) + Unmarshal func(schema Schema, data []byte, v interface{}) error + type ArraySchema struct + func NewArraySchema(items Schema) *ArraySchema + func (p *ArraySchema) AddProp(name string, value interface{}) + func (p *ArraySchema) Prop(name string) interface{} + func (s *ArraySchema) Fingerprint() [32]byte + func (s *ArraySchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *ArraySchema) Items() Schema + func (s *ArraySchema) MarshalJSON() ([]byte, error) + func (s *ArraySchema) String() string + func (s *ArraySchema) Type() Type + type Config struct + BlockLength int + TagKey string + UnionResolutionError bool + func (c Config) Freeze() API + type DecimalLogicalSchema struct + func NewDecimalLogicalSchema(prec, scale int) *DecimalLogicalSchema + func (s *DecimalLogicalSchema) Precision() int + func (s *DecimalLogicalSchema) Scale() int + func (s *DecimalLogicalSchema) String() string + func (s *DecimalLogicalSchema) Type() LogicalType + type Decoder struct + func NewDecoder(s string, r io.Reader) (*Decoder, error) + func NewDecoderForSchema(schema Schema, reader io.Reader) *Decoder + func (d *Decoder) Decode(obj interface{}) error + type Encoder struct + func NewEncoder(s string, w io.Writer) (*Encoder, error) + func NewEncoderForSchema(schema Schema, w io.Writer) *Encoder + func (e *Encoder) Encode(v interface{}) error + type EnumSchema struct + func NewEnumSchema(name, namespace string, symbols []string) (*EnumSchema, error) + func (n EnumSchema) FullName() string + func (n EnumSchema) Name() string + func (n EnumSchema) Namespace() string + func (p *EnumSchema) AddProp(name string, value interface{}) + func (p *EnumSchema) Prop(name string) interface{} + func (s *EnumSchema) Fingerprint() [32]byte + func (s *EnumSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *EnumSchema) MarshalJSON() ([]byte, error) + func (s *EnumSchema) String() string + func (s *EnumSchema) Symbols() []string + func (s *EnumSchema) Type() Type + type Field struct + func NewField(name string, typ Schema, def interface{}) (*Field, error) + func (f *Field) AddDoc(doc string) + func (f *Field) Default() interface{} + func (f *Field) Doc() string + func (f *Field) HasDefault() bool + func (f *Field) MarshalJSON() ([]byte, error) + func (f *Field) Name() string + func (f *Field) String() string + func (f *Field) Type() Schema + func (p *Field) AddProp(name string, value interface{}) + func (p *Field) Prop(name string) interface{} + type FingerprintType string + const CRC64Avro + const MD5 + const SHA256 + type FixedSchema struct + func NewFixedSchema(name, namespace string, size int, logical LogicalSchema) (*FixedSchema, error) + func (n FixedSchema) FullName() string + func (n FixedSchema) Name() string + func (n FixedSchema) Namespace() string + func (p *FixedSchema) AddProp(name string, value interface{}) + func (p *FixedSchema) Prop(name string) interface{} + func (s *FixedSchema) Fingerprint() [32]byte + func (s *FixedSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *FixedSchema) Logical() LogicalSchema + func (s *FixedSchema) MarshalJSON() ([]byte, error) + func (s *FixedSchema) Size() int + func (s *FixedSchema) String() string + func (s *FixedSchema) Type() Type + type LogicalSchema interface + String func() string + Type func() LogicalType + type LogicalType string + const Date + const Decimal + const Duration + const TimeMicros + const TimeMillis + const TimestampMicros + const TimestampMillis + const UUID + type LogicalTypeSchema interface + Logical func() LogicalSchema + type MapSchema struct + func NewMapSchema(values Schema) *MapSchema + func (p *MapSchema) AddProp(name string, value interface{}) + func (p *MapSchema) Prop(name string) interface{} + func (s *MapSchema) Fingerprint() [32]byte + func (s *MapSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *MapSchema) MarshalJSON() ([]byte, error) + func (s *MapSchema) String() string + func (s *MapSchema) Type() Type + func (s *MapSchema) Values() Schema + type Message struct + func NewMessage(req *RecordSchema, resp Schema, errors *UnionSchema, oneWay bool) *Message + func (m *Message) Errors() *UnionSchema + func (m *Message) OneWay() bool + func (m *Message) Request() *RecordSchema + func (m *Message) Response() Schema + func (m *Message) String() string + func (p *Message) AddProp(name string, value interface{}) + func (p *Message) Prop(name string) interface{} + type NamedSchema interface + FullName func() string + Name func() string + Namespace func() string + type NullSchema struct + func (s *NullSchema) Fingerprint() [32]byte + func (s *NullSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *NullSchema) MarshalJSON() ([]byte, error) + func (s *NullSchema) String() string + func (s *NullSchema) Type() Type + type PrimitiveLogicalSchema struct + func NewPrimitiveLogicalSchema(typ LogicalType) *PrimitiveLogicalSchema + func (s *PrimitiveLogicalSchema) String() string + func (s *PrimitiveLogicalSchema) Type() LogicalType + type PrimitiveSchema struct + func NewPrimitiveSchema(t Type, l LogicalSchema) *PrimitiveSchema + func (s *PrimitiveSchema) Fingerprint() [32]byte + func (s *PrimitiveSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *PrimitiveSchema) Logical() LogicalSchema + func (s *PrimitiveSchema) MarshalJSON() ([]byte, error) + func (s *PrimitiveSchema) String() string + func (s *PrimitiveSchema) Type() Type + type PropertySchema interface + AddProp func(name string, value interface{}) + Prop func(string) interface{} + type Protocol struct + func MustParseProtocol(protocol string) *Protocol + func NewProtocol(name, space string, types []NamedSchema, messages map[string]*Message) (*Protocol, error) + func ParseProtocol(protocol string) (*Protocol, error) + func ParseProtocolFile(path string) (*Protocol, error) + func (n Protocol) FullName() string + func (n Protocol) Name() string + func (n Protocol) Namespace() string + func (p *Protocol) AddProp(name string, value interface{}) + func (p *Protocol) Hash() string + func (p *Protocol) Message(name string) *Message + func (p *Protocol) Prop(name string) interface{} + func (p *Protocol) String() string + type Reader struct + Error error + func NewReader(r io.Reader, bufSize int, opts ...ReaderFunc) *Reader + func (r *Reader) Read(b []byte) + func (r *Reader) ReadArrayCB(callback func(*Reader) bool) + func (r *Reader) ReadBlockHeader() (int64, int64) + func (r *Reader) ReadBool() bool + func (r *Reader) ReadBytes() []byte + func (r *Reader) ReadDouble() float64 + func (r *Reader) ReadFloat() float32 + func (r *Reader) ReadInt() int32 + func (r *Reader) ReadLong() int64 + func (r *Reader) ReadMapCB(callback func(*Reader, string) bool) + func (r *Reader) ReadNext(schema Schema) interface{} + func (r *Reader) ReadString() string + func (r *Reader) ReadVal(schema Schema, obj interface{}) + func (r *Reader) ReportError(operation, msg string) + func (r *Reader) Reset(b []byte) *Reader + func (r *Reader) SkipBool() + func (r *Reader) SkipBytes() + func (r *Reader) SkipDouble() + func (r *Reader) SkipFloat() + func (r *Reader) SkipInt() + func (r *Reader) SkipLong() + func (r *Reader) SkipNBytes(n int) + func (r *Reader) SkipString() + type ReaderFunc func(r *Reader) + func WithReaderConfig(cfg API) ReaderFunc + type RecordSchema struct + func NewErrorRecordSchema(name, space string, fields []*Field) (*RecordSchema, error) + func NewRecordSchema(name, space string, fields []*Field) (*RecordSchema, error) + func (n RecordSchema) FullName() string + func (n RecordSchema) Name() string + func (n RecordSchema) Namespace() string + func (p *RecordSchema) AddProp(name string, value interface{}) + func (p *RecordSchema) Prop(name string) interface{} + func (s *RecordSchema) AddDoc(doc string) + func (s *RecordSchema) Doc() string + func (s *RecordSchema) Fields() []*Field + func (s *RecordSchema) Fingerprint() [32]byte + func (s *RecordSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *RecordSchema) IsError() bool + func (s *RecordSchema) MarshalJSON() ([]byte, error) + func (s *RecordSchema) String() string + func (s *RecordSchema) Type() Type + type RefSchema struct + func NewRefSchema(schema NamedSchema) *RefSchema + func (s *RefSchema) Fingerprint() [32]byte + func (s *RefSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *RefSchema) MarshalJSON() ([]byte, error) + func (s *RefSchema) Schema() Schema + func (s *RefSchema) String() string + func (s *RefSchema) Type() Type + type Schema interface + Fingerprint func() [32]byte + FingerprintUsing func(FingerprintType) ([]byte, error) + String func() string + Type func() Type + func MustParse(schema string) Schema + func Parse(schema string) (Schema, error) + func ParseFiles(paths ...string) (Schema, error) + func ParseWithCache(schema, namespace string, cache *SchemaCache) (Schema, error) + type SchemaCache struct + func (c *SchemaCache) Add(name string, schema Schema) + func (c *SchemaCache) Get(name string) Schema + type SchemaCompatibility struct + func NewSchemaCompatibility() *SchemaCompatibility + func (c *SchemaCompatibility) Compatible(reader, writer Schema) error + type Schemas []Schema + func (s Schemas) Get(name string) (Schema, int) + type Type string + const Array + const Boolean + const Bytes + const Double + const Enum + const Error + const Fixed + const Float + const Int + const Long + const Map + const Null + const Record + const Ref + const String + const Union + type TypeResolver struct + func NewTypeResolver() *TypeResolver + func (r *TypeResolver) Name(typ reflect2.Type) ([]string, error) + func (r *TypeResolver) Register(name string, obj interface{}) + func (r *TypeResolver) Type(name string) (reflect2.Type, error) + type UnionSchema struct + func NewUnionSchema(types []Schema) (*UnionSchema, error) + func (s *UnionSchema) Fingerprint() [32]byte + func (s *UnionSchema) FingerprintUsing(typ FingerprintType) ([]byte, error) + func (s *UnionSchema) Indices() (null, typ int) + func (s *UnionSchema) MarshalJSON() ([]byte, error) + func (s *UnionSchema) Nullable() bool + func (s *UnionSchema) String() string + func (s *UnionSchema) Type() Type + func (s *UnionSchema) Types() Schemas + type ValDecoder interface + Decode func(ptr unsafe.Pointer, r *Reader) + type ValEncoder interface + Encode func(ptr unsafe.Pointer, w *Writer) + type Writer struct + Error error + func NewWriter(out io.Writer, bufSize int, opts ...WriterFunc) *Writer + func (w *Writer) Buffer() []byte + func (w *Writer) Buffered() int + func (w *Writer) Flush() error + func (w *Writer) Reset(out io.Writer) + func (w *Writer) Write(b []byte) + func (w *Writer) WriteBlockCB(callback func(w *Writer) int64) int64 + func (w *Writer) WriteBlockHeader(l, s int64) + func (w *Writer) WriteBool(b bool) + func (w *Writer) WriteBytes(b []byte) + func (w *Writer) WriteDouble(f float64) + func (w *Writer) WriteFloat(f float32) + func (w *Writer) WriteInt(i int32) + func (w *Writer) WriteLong(i int64) + func (w *Writer) WriteString(s string) + func (w *Writer) WriteVal(schema Schema, val interface{}) + type WriterFunc func(w *Writer) + func WithWriterConfig(cfg API) WriterFunc