Documentation
¶
Index ¶
- Constants
- func PreDecode(r io.Reader, v *reflect.Value, nullable bool) (bool, error)
- func PreEncode(w io.Writer, v *reflect.Value, nullable bool) (bool, error)
- func ReadUvarint(r io.Reader) (uint64, error)
- func Register(ifaces ...interface{}) error
- func WriteUvarint(w io.Writer, v uint64) error
- type BoolSchema
- func (s *BoolSchema) Decode(r io.Reader, i interface{}) error
- func (s *BoolSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *BoolSchema) Encode(w io.Writer, i interface{}) error
- func (s *BoolSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *BoolSchema) GoType() reflect.Type
- func (s *BoolSchema) MarshalJSON() ([]byte, error)
- func (s *BoolSchema) MarshalSchemer() ([]byte, error)
- type ComplexSchema
- func (s *ComplexSchema) Decode(r io.Reader, i interface{}) error
- func (s *ComplexSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *ComplexSchema) Encode(w io.Writer, i interface{}) error
- func (s *ComplexSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *ComplexSchema) GoType() reflect.Type
- func (s *ComplexSchema) MarshalJSON() ([]byte, error)
- func (s *ComplexSchema) MarshalSchemer() ([]byte, error)
- func (s *ComplexSchema) Valid() bool
- type DateSchema
- func (s *DateSchema) Decode(r io.Reader, i interface{}) error
- func (s *DateSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *DateSchema) Encode(w io.Writer, i interface{}) error
- func (s *DateSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *DateSchema) GoType() reflect.Type
- func (s *DateSchema) MarshalJSON() ([]byte, error)
- func (s *DateSchema) MarshalSchemer() ([]byte, error)
- type EnumSchema
- func (s *EnumSchema) Decode(r io.Reader, i interface{}) error
- func (s *EnumSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *EnumSchema) Encode(w io.Writer, i interface{}) error
- func (s *EnumSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *EnumSchema) GoType() reflect.Type
- func (s *EnumSchema) MarshalJSON() ([]byte, error)
- func (s EnumSchema) MarshalSchemer() ([]byte, error)
- type FixedArraySchema
- func (s *FixedArraySchema) Decode(r io.Reader, i interface{}) error
- func (s *FixedArraySchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *FixedArraySchema) Encode(w io.Writer, i interface{}) error
- func (s *FixedArraySchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *FixedArraySchema) GoType() reflect.Type
- func (s *FixedArraySchema) MarshalJSON() ([]byte, error)
- func (s *FixedArraySchema) MarshalSchemer() ([]byte, error)
- func (s *FixedArraySchema) Valid() bool
- type FixedIntSchema
- func (s *FixedIntSchema) Decode(r io.Reader, i interface{}) error
- func (s *FixedIntSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *FixedIntSchema) Encode(w io.Writer, i interface{}) error
- func (s *FixedIntSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *FixedIntSchema) GoType() reflect.Type
- func (s *FixedIntSchema) MarshalJSON() ([]byte, error)
- func (s *FixedIntSchema) MarshalSchemer() ([]byte, error)
- func (s *FixedIntSchema) Valid() bool
- type FixedObjectSchema
- func (s *FixedObjectSchema) Decode(r io.Reader, i interface{}) error
- func (s *FixedObjectSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *FixedObjectSchema) Encode(w io.Writer, i interface{}) error
- func (s *FixedObjectSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *FixedObjectSchema) GoType() reflect.Type
- func (s *FixedObjectSchema) MarshalJSON() ([]byte, error)
- func (s *FixedObjectSchema) MarshalSchemer() ([]byte, error)
- type FixedStringSchema
- func (s *FixedStringSchema) Decode(r io.Reader, i interface{}) error
- func (s *FixedStringSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *FixedStringSchema) Encode(w io.Writer, i interface{}) error
- func (s *FixedStringSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *FixedStringSchema) GoType() reflect.Type
- func (s *FixedStringSchema) MarshalJSON() ([]byte, error)
- func (s *FixedStringSchema) MarshalSchemer() ([]byte, error)
- func (s *FixedStringSchema) Valid() bool
- type FloatSchema
- func (s *FloatSchema) Decode(r io.Reader, i interface{}) error
- func (s *FloatSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *FloatSchema) Encode(w io.Writer, i interface{}) error
- func (s *FloatSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *FloatSchema) GoType() reflect.Type
- func (s *FloatSchema) MarshalJSON() ([]byte, error)
- func (s *FloatSchema) MarshalSchemer() ([]byte, error)
- func (s *FloatSchema) Valid() bool
- type Marshaler
- type ObjectField
- type Schema
- type SchemaGenerator
- type SchemaOptions
- type StructTag
- type VarArraySchema
- func (s *VarArraySchema) Decode(r io.Reader, i interface{}) error
- func (s *VarArraySchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *VarArraySchema) Encode(w io.Writer, i interface{}) error
- func (s *VarArraySchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *VarArraySchema) GoType() reflect.Type
- func (s *VarArraySchema) MarshalJSON() ([]byte, error)
- func (s *VarArraySchema) MarshalSchemer() ([]byte, error)
- type VarIntSchema
- func (s *VarIntSchema) Decode(r io.Reader, i interface{}) error
- func (s *VarIntSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *VarIntSchema) Encode(w io.Writer, i interface{}) error
- func (s *VarIntSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *VarIntSchema) GoType() reflect.Type
- func (s *VarIntSchema) MarshalJSON() ([]byte, error)
- func (s *VarIntSchema) MarshalSchemer() ([]byte, error)
- type VarObjectSchema
- func (s *VarObjectSchema) Decode(r io.Reader, i interface{}) error
- func (s *VarObjectSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *VarObjectSchema) Encode(w io.Writer, i interface{}) error
- func (s *VarObjectSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *VarObjectSchema) GoType() reflect.Type
- func (s *VarObjectSchema) MarshalJSON() ([]byte, error)
- func (s *VarObjectSchema) MarshalSchemer() ([]byte, error)
- type VarStringSchema
- func (s *VarStringSchema) Decode(r io.Reader, i interface{}) error
- func (s *VarStringSchema) DecodeValue(r io.Reader, v reflect.Value) error
- func (s *VarStringSchema) Encode(w io.Writer, i interface{}) error
- func (s *VarStringSchema) EncodeValue(w io.Writer, v reflect.Value) error
- func (s *VarStringSchema) GoType() reflect.Type
- func (s *VarStringSchema) MarshalJSON() ([]byte, error)
- func (s *VarStringSchema) MarshalSchemer() ([]byte, error)
Constants ¶
const ( NullMask = 0x80 // nullable bit CustomMask = 0x40 // custom schema bit CustomIDMask = 0x3F // custom schema identifier // FixedInt is 0b000 nnns where s is the signed/unsigned bit and // n represents the encoded integer size in (8 << n) bits. FixedIntMask = 0x70 FixedIntByte = 0x00 FixedIntBitsMask = 0x0E // Note: Needs to be shifted right 1 IntSignedMask = 0x01 VarIntMask = 0x7E // 0b001 000s where s is the signed/unsigned bit VarIntByte = 0x10 // Float is 0b001 01nn where n is the floating-point size in (32 << n) bits FloatMask = 0x7C FloatBitsMask = 0x03 FloatByte = 0x14 // Complex is 0b001 10nn where n is the complex number size in (64 << n) bits ComplexMask = 0x7C ComplexBitsMask = 0x03 ComplexByte = 0x18 BoolMask = 0x7F // 0b001 1100 BoolByte = 0x1C EnumMask = 0x7F // 0b001 1101 EnumByte = 0x1D StringMask = 0x7F // 0b010 000f where f indicates fixed-length string VarStringByte = 0x20 FixedStringByte = 0x21 ArrayMask = 0x7F // 0b010 010f where f indicates fixed-length array VarArrayByte = 0x24 FixedArrayByte = 0x25 // Object is 0b010 100f where f indicates that the object has fixed fields ObjectMask = 0x7F VarObjectByte = 0x28 FixedObjectByte = 0x29 )
Collection of bit masks and values for the type byte of an encoded schema
const StructTagName string = "schemer"
StructTagName is the Go struct tag name used by schemer
Variables ¶
This section is empty.
Functions ¶
func PreDecode ¶
PreDecode is a helper function that should be called by each Schema's Decode routine. It removes exactly one level of indirection for v and reads the null byte if nullable is set. If a null value is read, (true, nil) is returned, indicating that no further processing is needed by the decoder who called this routine. This routine also ensures that the destination value is settable and returns errors if not. Finally, this routine populates nested pointer values recursively, as needed.
func PreEncode ¶
PreEncode is a helper function that should be called by each Schema's Encode routine. It dereferences v if the value is a pointer or interface type and writes the null byte if nullable is set. If nullable is false and v resolves to nil, an error is returned. If nullable is true and v resolves to nil, (true, nil) is returned, indicating that no further processing is needed by the encoder who called this routine. Otherwise, false, nil is returned.
func ReadUvarint ¶
ReadUvarint reads an Uvarint from r one byte at a time
func Register ¶
func Register(ifaces ...interface{}) error
Register records custom schema generators that implement `SchemaOfType`, `DecodeSchema`, and/or `DecodeSchemaJSON`. When `schemer.SchemaOfType` is called, `SchemaOfType` is called on each registered schema generator to determine if a custom Schema should be used for a given type.
Types ¶
type BoolSchema ¶
type BoolSchema struct {
SchemaOptions
}
BoolSchema is a Schema for encoding and decoding boolean values
func (*BoolSchema) Decode ¶
func (s *BoolSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and stores it in i
func (*BoolSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and stores it in v
func (*BoolSchema) Encode ¶
func (s *BoolSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*BoolSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*BoolSchema) GoType ¶
func (s *BoolSchema) GoType() reflect.Type
GoType returns the default Go type that represents the schema
func (*BoolSchema) MarshalJSON ¶
func (s *BoolSchema) MarshalJSON() ([]byte, error)
MarshalJSON encodes the schema in a JSON format
func (*BoolSchema) MarshalSchemer ¶
func (s *BoolSchema) MarshalSchemer() ([]byte, error)
MarshalSchemer encodes the schema in a portable binary format
type ComplexSchema ¶
type ComplexSchema struct { SchemaOptions Bits int // must be 64 or 128 }
func (*ComplexSchema) Decode ¶
func (s *ComplexSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*ComplexSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*ComplexSchema) Encode ¶
func (s *ComplexSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*ComplexSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*ComplexSchema) GoType ¶
func (s *ComplexSchema) GoType() reflect.Type
func (*ComplexSchema) MarshalJSON ¶
func (s *ComplexSchema) MarshalJSON() ([]byte, error)
func (*ComplexSchema) MarshalSchemer ¶
func (s *ComplexSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
func (*ComplexSchema) Valid ¶
func (s *ComplexSchema) Valid() bool
type DateSchema ¶
type DateSchema struct {
SchemaOptions
}
func (*DateSchema) Decode ¶
func (s *DateSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*DateSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded valuethe input stream and store it in v
func (*DateSchema) Encode ¶
func (s *DateSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*DateSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of he output stream
func (*DateSchema) GoType ¶
func (s *DateSchema) GoType() reflect.Type
func (*DateSchema) MarshalJSON ¶
func (s *DateSchema) MarshalJSON() ([]byte, error)
func (*DateSchema) MarshalSchemer ¶
func (s *DateSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
type EnumSchema ¶
type EnumSchema struct { SchemaOptions Values map[int]string }
func (*EnumSchema) Decode ¶
func (s *EnumSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*EnumSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*EnumSchema) Encode ¶
func (s *EnumSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*EnumSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output streamtream
func (*EnumSchema) GoType ¶
func (s *EnumSchema) GoType() reflect.Type
func (*EnumSchema) MarshalJSON ¶
func (s *EnumSchema) MarshalJSON() ([]byte, error)
func (EnumSchema) MarshalSchemer ¶
func (s EnumSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
type FixedArraySchema ¶
type FixedArraySchema struct { SchemaOptions Length int Element Schema }
func (*FixedArraySchema) Decode ¶
func (s *FixedArraySchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*FixedArraySchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*FixedArraySchema) Encode ¶
func (s *FixedArraySchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*FixedArraySchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*FixedArraySchema) GoType ¶
func (s *FixedArraySchema) GoType() reflect.Type
func (*FixedArraySchema) MarshalJSON ¶
func (s *FixedArraySchema) MarshalJSON() ([]byte, error)
func (*FixedArraySchema) MarshalSchemer ¶
func (s *FixedArraySchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
func (*FixedArraySchema) Valid ¶
func (s *FixedArraySchema) Valid() bool
type FixedIntSchema ¶
type FixedIntSchema struct { SchemaOptions Signed bool Bits int // must be 8, 16, 32, or 64 }
func (*FixedIntSchema) Decode ¶
func (s *FixedIntSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*FixedIntSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*FixedIntSchema) Encode ¶
func (s *FixedIntSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*FixedIntSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*FixedIntSchema) GoType ¶
func (s *FixedIntSchema) GoType() reflect.Type
func (*FixedIntSchema) MarshalJSON ¶
func (s *FixedIntSchema) MarshalJSON() ([]byte, error)
func (*FixedIntSchema) MarshalSchemer ¶
func (s *FixedIntSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
func (*FixedIntSchema) Valid ¶
func (s *FixedIntSchema) Valid() bool
type FixedObjectSchema ¶
type FixedObjectSchema struct { SchemaOptions Fields []ObjectField }
func (*FixedObjectSchema) Decode ¶
func (s *FixedObjectSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in v
func (*FixedObjectSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*FixedObjectSchema) Encode ¶
func (s *FixedObjectSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*FixedObjectSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*FixedObjectSchema) GoType ¶
func (s *FixedObjectSchema) GoType() reflect.Type
func (*FixedObjectSchema) MarshalJSON ¶
func (s *FixedObjectSchema) MarshalJSON() ([]byte, error)
func (*FixedObjectSchema) MarshalSchemer ¶
func (s *FixedObjectSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
type FixedStringSchema ¶
type FixedStringSchema struct { SchemaOptions Length int }
func (*FixedStringSchema) Decode ¶
func (s *FixedStringSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*FixedStringSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*FixedStringSchema) Encode ¶
func (s *FixedStringSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*FixedStringSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*FixedStringSchema) GoType ¶
func (s *FixedStringSchema) GoType() reflect.Type
func (*FixedStringSchema) MarshalJSON ¶
func (s *FixedStringSchema) MarshalJSON() ([]byte, error)
func (*FixedStringSchema) MarshalSchemer ¶
func (s *FixedStringSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
func (*FixedStringSchema) Valid ¶
func (s *FixedStringSchema) Valid() bool
type FloatSchema ¶
type FloatSchema struct { SchemaOptions Bits int // must be 32 or 64 }
func (*FloatSchema) Decode ¶
func (s *FloatSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*FloatSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*FloatSchema) Encode ¶
func (s *FloatSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*FloatSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*FloatSchema) GoType ¶
func (s *FloatSchema) GoType() reflect.Type
func (*FloatSchema) MarshalJSON ¶
func (s *FloatSchema) MarshalJSON() ([]byte, error)
func (*FloatSchema) MarshalSchemer ¶
func (s *FloatSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
func (*FloatSchema) Valid ¶
func (s *FloatSchema) Valid() bool
type Marshaler ¶
Marshaler is an interface implemented by a schema, allowing it to encode itself into a portable binary format
type ObjectField ¶
type Schema ¶
type Schema interface { // Encode uses the schema to write the encoded value of i to the output // stream Encode(w io.Writer, i interface{}) error // EncodeValue uses the schema to write the encoded value of v to the output // stream EncodeValue(w io.Writer, v reflect.Value) error // Decode uses the schema to read the next encoded value from the input // stream and stores it in i Decode(r io.Reader, i interface{}) error // DecodeValue uses the schema to read the next encoded value from the input // stream and stores it in v DecodeValue(r io.Reader, v reflect.Value) error // GoType returns the default Go type that represents the schema GoType() reflect.Type }
Schema is an interface that encodes and decodes data of a specific type
func DecodeSchema ¶
DecodeSchema decodes a binary encoded schema by reading from r No internal buffering is used when reading from r
func DecodeSchemaJSON ¶
DecodeSchemaJSON takes a buffer of JSON data and parses it to create a schema The input stream r is read in its entirety before the JSON is decoded.
type SchemaGenerator ¶
type SchemaGenerator interface { SchemaOfType(t reflect.Type) (Schema, error) DecodeSchema(r io.Reader) (Schema, error) DecodeSchemaJSON(r io.Reader) (Schema, error) }
SchemaGenerator is an interface implemented by custom schema generators. When Register is called on a SchemaGenerator, the global SchemaOf, DecodeSchema, and DecodeSchemaJSON functions will call the identically named method on each schema generator to determine if a custom schema should be returned. If a SchemaGenerator cannot return a Schema for a specific type, it should return nil, nil. If all schema generators return a nil Schema or if Register is never called, then the built-in logic for returning a Schema is used.
type SchemaOptions ¶
type SchemaOptions struct {
// contains filtered or unexported fields
}
SchemaOptions are options common to each Schema
func (*SchemaOptions) Nullable ¶
func (o *SchemaOptions) Nullable() bool
Nullable indicates that the value encoded or decoded can be either the underlying type or a null value
func (*SchemaOptions) SetNullable ¶
func (o *SchemaOptions) SetNullable(n bool)
SetNullable sets the nullable flag
func (*SchemaOptions) SetWeakDecoding ¶
func (o *SchemaOptions) SetWeakDecoding(w bool)
SetWeakDecoding sets the weak decoding flag
func (*SchemaOptions) WeakDecoding ¶
func (o *SchemaOptions) WeakDecoding() bool
WeakDecoding indicates that the schema should be more lenient when decoding (i.e. decoding a boolean to a string). See README for details.
type StructTag ¶
type StructTag struct { FieldAliases []string // list of names of fields. This comes from the name of the field in the struct, and also struct tags FieldAliasesSet bool // if true, struct tags are present on this field Nullable bool // is this field nullable? NullableSet bool // if true, then the null struct tags is present on this field WeakDecoding bool // does this field allow weak decoding? WeakDecodingSet bool // if true, weak decoding was present in the struct tag for this field }
StructTag represents information that can be parsed from a schemer struct tag
func ParseStructTag ¶
ParseStructTag parses a struct tag string and returns a decoded StructTag the format of the tag must be: tag := alias? ("," option)* alias := "-" |
identifier | "[" identifier ("," identifier)* "]"
option := "!" ? ( "weak" | "null" ) If the
type VarArraySchema ¶
type VarArraySchema struct { SchemaOptions Element Schema }
func (*VarArraySchema) Decode ¶
func (s *VarArraySchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*VarArraySchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*VarArraySchema) Encode ¶
func (s *VarArraySchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*VarArraySchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*VarArraySchema) GoType ¶
func (s *VarArraySchema) GoType() reflect.Type
func (*VarArraySchema) MarshalJSON ¶
func (s *VarArraySchema) MarshalJSON() ([]byte, error)
func (*VarArraySchema) MarshalSchemer ¶
func (s *VarArraySchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
type VarIntSchema ¶
type VarIntSchema struct { SchemaOptions Signed bool }
func (*VarIntSchema) Decode ¶
func (s *VarIntSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*VarIntSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*VarIntSchema) Encode ¶
func (s *VarIntSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*VarIntSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*VarIntSchema) GoType ¶
func (s *VarIntSchema) GoType() reflect.Type
func (*VarIntSchema) MarshalJSON ¶
func (s *VarIntSchema) MarshalJSON() ([]byte, error)
func (*VarIntSchema) MarshalSchemer ¶
func (s *VarIntSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
type VarObjectSchema ¶
type VarObjectSchema struct { SchemaOptions Key Schema Value Schema }
func (*VarObjectSchema) Decode ¶
func (s *VarObjectSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*VarObjectSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*VarObjectSchema) Encode ¶
func (s *VarObjectSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*VarObjectSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output streamm
func (*VarObjectSchema) GoType ¶
func (s *VarObjectSchema) GoType() reflect.Type
func (*VarObjectSchema) MarshalJSON ¶
func (s *VarObjectSchema) MarshalJSON() ([]byte, error)
func (*VarObjectSchema) MarshalSchemer ¶
func (s *VarObjectSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format
type VarStringSchema ¶
type VarStringSchema struct {
SchemaOptions
}
func (*VarStringSchema) Decode ¶
func (s *VarStringSchema) Decode(r io.Reader, i interface{}) error
Decode uses the schema to read the next encoded value from the input stream and store it in i
func (*VarStringSchema) DecodeValue ¶
DecodeValue uses the schema to read the next encoded value from the input stream and store it in v
func (*VarStringSchema) Encode ¶
func (s *VarStringSchema) Encode(w io.Writer, i interface{}) error
Encode uses the schema to write the encoded value of i to the output stream
func (*VarStringSchema) EncodeValue ¶
EncodeValue uses the schema to write the encoded value of v to the output stream
func (*VarStringSchema) GoType ¶
func (s *VarStringSchema) GoType() reflect.Type
func (*VarStringSchema) MarshalJSON ¶
func (s *VarStringSchema) MarshalJSON() ([]byte, error)
func (*VarStringSchema) MarshalSchemer ¶
func (s *VarStringSchema) MarshalSchemer() ([]byte, error)
Bytes encodes the schema in a portable binary format