Documentation
¶
Index ¶
- Variables
- func DecodeFloat32(f uint32) float32
- func DecodeFloat64(f uint64) float64
- func DecodeInt16FromBytes(b []byte) (int16, error)
- func DecodeInt32FromByte(b []byte) (int32, error)
- func DecodeInt64FromBytes(b []byte) (int64, error)
- func DecodeUInt16(d []byte) uint16
- func DecodeUint16FromBytes(b []byte) (uint16, error)
- func DecodeUint32FromBytes(b []byte) (uint32, error)
- func DecodeUint64FromBytes(b []byte) (uint64, error)
- func DecodeVarInt32(b []byte) (uint32, int)
- func DecodeVarInt64(buf []byte) (x uint64, n int)
- func EncodeFloat32(f float32) uint32
- func EncodeFloat64(f float64) uint64
- func EncodeInt32ToBytes(f int32, b []byte) error
- func EncodeInt64ToBytes(f int64, b []byte) error
- func EncodeUInt16(x uint16) []byte
- func EncodeUint16ToBytes(f uint16, b []byte) error
- func EncodeUint32ToBytes(f uint32, b []byte) error
- func EncodeUint64ToBytes(f uint64, b []byte) error
- func EncodeVarInt32(x uint32) []byte
- func EncodeVarInt64(x uint64) []byte
- type AppendWriter
- type BooleanCodec
- func (BooleanCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
- func (BooleanCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
- func (BooleanCodec) NativeToBinary(b interface{}, f voxa.FieldID, c []byte) ([]byte, error)
- func (BooleanCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
- func (BooleanCodec) TextualToNative(b []byte) (interface{}, error)
- type ByteCodec
- type BytesCodec
- func (BytesCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
- func (BytesCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
- func (BytesCodec) NativeToBinary(b interface{}, id voxa.FieldID, c []byte) ([]byte, error)
- func (BytesCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
- func (BytesCodec) TextualToNative(b []byte) (interface{}, error)
- type FloatCodec
- func (FloatCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
- func (FloatCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
- func (FloatCodec) NativeToBinary(b interface{}, id voxa.FieldID, c []byte) ([]byte, error)
- func (FloatCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
- func (FloatCodec) TextualToNative(b []byte) (interface{}, error)
- type HeaderCodec
- type IntCodec
- func (IntCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
- func (IntCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
- func (IntCodec) NativeToBinary(b interface{}, id voxa.FieldID, c []byte) ([]byte, error)
- func (IntCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
- func (IntCodec) TextualToNative(b []byte) (interface{}, error)
- type ListCodec
- type RecordCodec
- type TextCodec
- func (TextCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
- func (TextCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
- func (TextCodec) NativeToBinary(b interface{}, id voxa.FieldID, c []byte) ([]byte, error)
- func (TextCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
- func (TextCodec) TextualToNative(b []byte) (interface{}, error)
- type TimeCodec
- func (TimeCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
- func (TimeCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
- func (TimeCodec) NativeToBinary(b interface{}, id voxa.FieldID, c []byte) ([]byte, error)
- func (TimeCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
- func (TimeCodec) TextualToNative(b []byte) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupported is returned when an implement does not support // an operation. ErrNotSupported = errors.New("not supported") // ErrDecodeFailed is returned when decoding a byte slice into native type failed. ErrDecodeFailed = errors.New("failed to decode value") )
errors ...
var ( // ErrValueUnsettable is returned when the reflect.Value is not settable. ErrValueUnsettable = errors.New("value can not be set on reflect type") // ErrInvalidNoSize is returned when provided data slice fails to match length standard. ErrInvalidNoSize = errors.New("invalid data, byte slice must have length length") // ErrInvalidDataSlice is returned when provided data slice fails to match length standard. ErrInvalidDataSlice = errors.New("invalid data, byte slice not matching expected data frame length") // ErrNotList is returned when data slice provided is not a voxa.List type. ErrNotList = errors.New("data item is not a list") // ErrInvalidFieldID is returned when the field id does not match expected. ErrInvalidFieldID = errors.New("data id does not match expected field id") // ErrSkipErr is returned when codec is not available for a giving type. ErrSkipErr = errors.New("no codec available for type") )
errors ...
var ( // ErrNotRecord is returned when data slice provided is not a voxa.Record type. ErrNotRecord = errors.New("data item is not a Record") // ErrMustBePointer is returned when type to be unmarshalled to is a value. ErrMustBePointer = errors.New("destination must be a pointer of desired type") // ErrTagMustBeUniqueToField is returned when a tag id number is found in another field. ErrTagMustBeUniqueToField = errors.New("id tag number already used") // ErrUnknownType is returned when type cant be processed. ErrUnknownType = errors.New("type unknown") // ErrUnknownTypeForMap is returned when type cant be made for when creating a map. ErrUnknownTypeForMap = errors.New("type unsupported for maps") // ErrTagMustBeNumber is returned when a tag contains more than digit values. ErrTagMustBeNumber = errors.New("id tag must contain only digits") // ErrTagCantBeMoreThanUint8 is returned when a tag contains more the max values for a uint8. ErrTagCantBeMoreThanUint8 = errors.New("id tag numbers must be less or equal to a uint8 or 255") )
Functions ¶
func DecodeFloat32 ¶
DecodeFloat32 will decode provided uint64 value which should be in standard IEEE 754 binary representation, where it bit has been reversed, where having it's exponent appears first. It returns the float32 value.
func DecodeFloat64 ¶
DecodeFloat64 will decode provided uint64 value which should be in standard IEEE 754 binary representation, where it bit has been reversed, where having it's exponent appears first. It returns the float64 value.
func DecodeInt16FromBytes ¶
DecodeInt16FromBytes attempts to decode provided byte slice into a int16 ensuring that it has minimum length of 2. It uses binary.BigEndian.
func DecodeInt32FromByte ¶
DecodeInt32FromBytes attempts to decode provided byte slice into a int32 ensuring that it has minimum length of 4. It uses binary.BigEndian.
func DecodeInt64FromBytes ¶
DecodeInt64FromBytes attempts to decode provided byte slice into a int64 ensuring that it has minimum length of 8. It uses binary.BigEndian.
func DecodeUInt16 ¶
DecodeUInt16 returns the decoded uint16 of provided byte slice which must be of length 2.
func DecodeUint16FromBytes ¶
DecodeUint16FromBytes attempts to decode provided byte slice into a uint16 ensuring that it has minimum length of 2. It uses binary.BigEndian.
func DecodeUint32FromBytes ¶
DecodeUint32FromBytes attempts to decode provided byte slice into a uint32 ensuring that it has minimum length of 4. It uses binary.BigEndian.
func DecodeUint64FromBytes ¶
DecodeUint64FromBytes attempts to decode provided byte slice into a uint64 ensuring that it has minimum length of 8. It uses binary.BigEndian.
func DecodeVarInt32 ¶
DecodeVarInt32 encodes uint32 into a byte slice using EncodeVarInt64 after turing uint32 into uin64.
func DecodeVarInt64 ¶
DecodeVarInt64 reads a varint-encoded integer from the slice. It returns the integer and the number of bytes consumed, or zero if there is not enough. This is the format for the int32, int64, uint32, uint64, bool.
func EncodeFloat32 ¶
EncodeFloat64 will encode provided float value into the standard IEEE 754 binary representation and has it's bit reversed, having the exponent appearing first.
func EncodeFloat64 ¶
EncodeFloat64 will encode provided float value into the standard IEEE 754 binary representation and has it's bit reversed, having the exponent appearing first.
func EncodeInt32ToBytes ¶
EncodeInt32ToBytes encodes provided uint32 into provided byte ensuring byte slice has minimum of length 4. It uses binary.BigEndian.
func EncodeInt64ToBytes ¶
EncodeInt64ToBytes encodes provided uint64 into provided byte ensuring byte slice has minimum of length 8. It uses binary.BigEndian.
func EncodeUInt16 ¶
EncodeUInt16 returns the encoded byte slice of a uint16 value.
func EncodeUint16ToBytes ¶
EncodeUint16ToBytes encodes provided uint16 into provided byte ensuring byte slice has minimum of length 2. It uses binary.BigEndian.
func EncodeUint32ToBytes ¶
EncodeUint32ToBytes encodes provided uint32 into provided byte ensuring byte slice has minimum of length 4. It uses binary.BigEndian.
func EncodeUint64ToBytes ¶
EncodeUint64ToBytes encodes provided uint64 into provided byte ensuring byte slice has minimum of length 8. It uses binary.BigEndian.
func EncodeVarInt32 ¶
EncodeVarInt32 encodes uint32 into a byte slice using EncodeVarInt64 after turing uint32 into uin64.
func EncodeVarInt64 ¶
EncodeVarInt64 returns the varint encoding of x. This is the format for the int32, int64, uint32, uint64, bool, and enum.
Types ¶
type AppendWriter ¶
type AppendWriter struct {
C []byte
}
AppendWriter implements io.Writer and writes all received data into a underline byte slice.
type BooleanCodec ¶
type BooleanCodec struct{}
func (BooleanCodec) BinaryToNative ¶
func (BooleanCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
func (BooleanCodec) MarshalTextualToNative ¶
func (BooleanCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
func (BooleanCodec) NativeToBinary ¶
func (BooleanCodec) NativeToTextual ¶
func (BooleanCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
func (BooleanCodec) TextualToNative ¶
func (BooleanCodec) TextualToNative(b []byte) (interface{}, error)
type BytesCodec ¶
type BytesCodec struct{}
func (BytesCodec) BinaryToNative ¶
func (BytesCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
func (BytesCodec) MarshalTextualToNative ¶
func (BytesCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
func (BytesCodec) NativeToBinary ¶
func (BytesCodec) NativeToTextual ¶
func (BytesCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
func (BytesCodec) TextualToNative ¶
func (BytesCodec) TextualToNative(b []byte) (interface{}, error)
type FloatCodec ¶
type FloatCodec struct{}
func (FloatCodec) BinaryToNative ¶
func (FloatCodec) BinaryToNative(b []byte) (interface{}, voxa.FieldID, error)
func (FloatCodec) MarshalTextualToNative ¶
func (FloatCodec) MarshalTextualToNative(_ []byte, _ interface{}) error
func (FloatCodec) NativeToBinary ¶
func (FloatCodec) NativeToTextual ¶
func (FloatCodec) NativeToTextual(b interface{}, c []byte) ([]byte, error)
func (FloatCodec) TextualToNative ¶
func (FloatCodec) TextualToNative(b []byte) (interface{}, error)
type HeaderCodec ¶
type HeaderCodec struct{}
HeaderCodec implements the voxa.HeaderCodec providing methods to turn giving field names and associated data into a byte slice with format: `[FieldID][Atom][Name Bytes...]` and vice-versa.
func (HeaderCodec) BinaryToField ¶
type IntCodec ¶
type IntCodec struct{}
func (IntCodec) BinaryToNative ¶
func (IntCodec) MarshalTextualToNative ¶
func (IntCodec) NativeToBinary ¶
func (IntCodec) NativeToTextual ¶
func (IntCodec) TextualToNative ¶
type ListCodec ¶
type ListCodec struct{}
func (ListCodec) BinaryToNative ¶
func (ListCodec) NativeToBinary ¶
type RecordCodec ¶
type RecordCodec struct{}
func (RecordCodec) BinaryToNative ¶
func (lc RecordCodec) BinaryToNative(b []byte, target interface{}) error
func (RecordCodec) NativeToBinary ¶
func (lc RecordCodec) NativeToBinary(b interface{}, c []byte) ([]byte, error)
func (RecordCodec) NativeToBinaryFrom ¶
type TextCodec ¶
type TextCodec struct{}
func (TextCodec) BinaryToNative ¶
func (TextCodec) MarshalTextualToNative ¶
func (TextCodec) NativeToBinary ¶
func (TextCodec) NativeToTextual ¶
func (TextCodec) TextualToNative ¶
type TimeCodec ¶
type TimeCodec struct{}