Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct{}
A Codec is a MessagePack implementation of an encoding.Codec.
func (Codec) NewDocument ¶
NewDocument implements the encoding.Codec interface.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes Genji documents and values from MessagePack.
func NewDecoder ¶
NewDecoder creates a Decoder that reads from the given reader.
func (*Decoder) DecodeArray ¶
DecodeArray decodes one array from the reader. If the array is malformed, this function will not return an error. However, calls to Iterate or GetByIndex will fail.
func (*Decoder) DecodeDocument ¶
DecodeDocument decodes one document from the reader. If the document is malformed, it will not return an error. However, calls to Iterate or GetByField will fail.
type EncodedArray ¶
type EncodedArray []byte
An EncodedArray implements the document.Array interface on top of an encoded representation of an array. It is useful for avoiding decoding the entire array when only a few values are needed.
func (EncodedArray) GetByIndex ¶
func (e EncodedArray) GetByIndex(idx int) (v document.Value, err error)
GetByIndex returns a value by index of the array.
type EncodedDocument ¶
type EncodedDocument []byte
An EncodedDocument implements the document.Document interface on top of an encoded representation of a document. It is useful for avoiding decoding the entire document when only a few fields are needed.
func (EncodedDocument) GetByField ¶
func (e EncodedDocument) GetByField(field string) (v document.Value, err error)
GetByField decodes the selected field from the buffer.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encodes Genji documents and values in MessagePack.
func NewEncoder ¶
NewEncoder creates an Encoder that writes in the given writer.
func (*Encoder) EncodeArray ¶
EncodeArray encodes a as a MessagePack array.
func (*Encoder) EncodeDocument ¶
EncodeDocument encodes d as a MessagePack map.
func (*Encoder) EncodeValue ¶
EncodeValue encodes v based on its type. - document -> map - array -> array - NULL -> nil - text -> string - blob -> bytes - bool -> bool - int8 -> int8 - int16 -> int16 - int32 -> int32 - int64 -> int64 - float64 -> float64