codecs

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// JSONBytes is a special case codec for json queries.
	// In go query json should return bytes not str.
	// but the descriptor type ID sent to the server
	// should still be str.
	JSONBytes = &bytesCodec{strID}
)

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Encoder
	Decoder
	Type() reflect.Type
}

Codec can Encode and Decode

type Decoder added in v0.6.0

type Decoder interface {
	DescriptorID() types.UUID
	Decode(*buff.Reader, unsafe.Pointer) error
}

Decoder can decode the data wire format into objects.

func BuildDecoder added in v0.6.0

func BuildDecoder(
	desc descriptor.Descriptor,
	typ reflect.Type,
	path Path,
) (Decoder, error)

BuildDecoder builds a Decoder from a Descriptor.

type DecoderField added in v0.6.0

type DecoderField struct {
	// contains filtered or unexported fields
}

DecoderField is a link to a child decoder used by objects, named tuples and tuples.

type Encoder added in v0.6.0

type Encoder interface {
	DescriptorID() types.UUID
	Encode(*buff.Writer, interface{}, Path, bool) error
}

Encoder can encode objects into the data wire format.

func BuildEncoder added in v0.6.0

func BuildEncoder(
	desc descriptor.Descriptor,
	version internal.ProtocolVersion,
) (Encoder, error)

BuildEncoder builds and Encoder from a Descriptor.

type EncoderField added in v0.6.0

type EncoderField struct {
	// contains filtered or unexported fields
}

EncoderField is a link to a child encoder used by objects, named tuples and tuples.

type OptionalDecoder added in v0.8.0

type OptionalDecoder interface {
	Decoder
	DecodeMissing(unsafe.Pointer)
}

OptionalDecoder is used when decoding optional shape fields.

type Path

type Path string

Path is used in error messages to show what field in a nested data structure caused the error.

func (Path) AddField

func (p Path) AddField(name string) Path

AddField adds a field name to the path.

func (Path) AddIndex

func (p Path) AddIndex(index int) Path

AddIndex adds an index to the path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL