codecs

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RelativeDurationID is the cal::relativeduration type descriptor ID
	RelativeDurationID = types.UUID{
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x11}
	// DateDurationID is the cal::date_duration type descriptor ID
	DateDurationID = types.UUID{
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x12}
	// UUIDID is the uuid type descriptor ID
	UUIDID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}
	// StrID is the str type descriptor ID
	StrID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}
	// BytesID is the bytes type descriptor ID
	BytesID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2}
	// Int16ID is the int16 type descriptor ID
	Int16ID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3}
	// Int32ID is the int32 type descriptor ID
	Int32ID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4}
	// Int64ID is the int64 type descriptor ID
	Int64ID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5}
	// Float32ID is the float32 type descriptor ID
	Float32ID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6}
	// Float64ID is the float64 type descriptor ID
	Float64ID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7}
	// DecimalID is the decimal type descriptor ID
	DecimalID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8}
	// BoolID is the bool type descriptor ID
	BoolID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9}
	// DateTimeID is the datetime type descriptor ID
	DateTimeID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0a}
	// LocalDTID is the cal::local_datetime type descriptor ID
	LocalDTID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0b}
	// LocalDateID is the cal::local_date type descriptor ID
	LocalDateID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0c}
	// LocalTimeID is the cal::local_time type descriptor ID
	LocalTimeID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0d}
	// DurationID is the duration type descriptor ID
	DurationID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0e}
	// JSONID is the json type descriptor ID
	JSONID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0f}
	// BigIntID is the bigint type descriptor ID
	BigIntID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x10}
	// MemoryID is the cfg::memory type descriptor ID
	MemoryID = types.UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x30}

	// 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

func GetScalarDescriptor added in v0.13.0

func GetScalarDescriptor(desc descriptor.Descriptor) descriptor.Descriptor

GetScalarDescriptor finds the BaseScalar descriptor at the root of the inheritance chain for a Scalar descriptor.

Types

type BigIntCodec added in v0.12.0

type BigIntCodec struct{}

BigIntCodec encodes/decodes *big.Int

func (*BigIntCodec) Decode added in v0.12.0

func (c *BigIntCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a *big.Int

func (*BigIntCodec) DescriptorID added in v0.12.0

func (c *BigIntCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*BigIntCodec) Encode added in v0.12.0

func (c *BigIntCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a *big.Int.

func (*BigIntCodec) Type added in v0.12.0

func (c *BigIntCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type BoolCodec added in v0.12.0

type BoolCodec struct{}

BoolCodec encodes/decodes bool.

func (*BoolCodec) Decode added in v0.12.0

func (c *BoolCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*BoolCodec) DescriptorID added in v0.12.0

func (c *BoolCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*BoolCodec) Encode added in v0.12.0

func (c *BoolCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*BoolCodec) Type added in v0.12.0

func (c *BoolCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type BytesCodec added in v0.12.0

type BytesCodec struct {
	ID types.UUID
}

BytesCodec encodes/decodes []byte values.

func (*BytesCodec) Decode added in v0.12.0

func (c *BytesCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*BytesCodec) DescriptorID added in v0.12.0

func (c *BytesCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*BytesCodec) Encode added in v0.12.0

func (c *BytesCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*BytesCodec) Type added in v0.12.0

func (c *BytesCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type Codec

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

Codec can Encode and Decode

type DateDurationCodec added in v0.12.0

type DateDurationCodec struct{}

DateDurationCodec encodes/decodes DateDuration values.

func (*DateDurationCodec) Decode added in v0.12.0

func (c *DateDurationCodec) Decode(
	r *buff.Reader,
	out unsafe.Pointer,
) error

Decode decodes a value

func (*DateDurationCodec) DescriptorID added in v0.12.0

func (c *DateDurationCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*DateDurationCodec) Encode added in v0.12.0

func (c *DateDurationCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*DateDurationCodec) Type added in v0.12.0

func (c *DateDurationCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type DateTimeCodec added in v0.12.0

type DateTimeCodec struct{}

DateTimeCodec encodes/decodes time.Time values.

func (*DateTimeCodec) Decode added in v0.12.0

func (c *DateTimeCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*DateTimeCodec) DescriptorID added in v0.12.0

func (c *DateTimeCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*DateTimeCodec) Encode added in v0.12.0

func (c *DateTimeCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*DateTimeCodec) Type added in v0.12.0

func (c *DateTimeCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

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 DurationCodec added in v0.12.0

type DurationCodec struct{}

DurationCodec encodes/decodes Duration values.

func (*DurationCodec) Decode added in v0.12.0

func (c *DurationCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*DurationCodec) DescriptorID added in v0.12.0

func (c *DurationCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*DurationCodec) Encode added in v0.12.0

func (c *DurationCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*DurationCodec) Type added in v0.12.0

func (c *DurationCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

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.

func BuildScalarEncoder added in v0.12.0

func BuildScalarEncoder(desc descriptor.Descriptor) (Encoder, error)

BuildScalarEncoder builds a scalar encoder.

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 Float32Codec added in v0.12.0

type Float32Codec struct{}

Float32Codec encodes/decodes float32.

func (*Float32Codec) Decode added in v0.12.0

func (c *Float32Codec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*Float32Codec) DescriptorID added in v0.12.0

func (c *Float32Codec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*Float32Codec) Encode added in v0.12.0

func (c *Float32Codec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*Float32Codec) Type added in v0.12.0

func (c *Float32Codec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type Float64Codec added in v0.12.0

type Float64Codec struct{}

Float64Codec encodes/decodes float64.

func (*Float64Codec) Decode added in v0.12.0

func (c *Float64Codec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*Float64Codec) DescriptorID added in v0.12.0

func (c *Float64Codec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*Float64Codec) Encode added in v0.12.0

func (c *Float64Codec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*Float64Codec) Type added in v0.12.0

func (c *Float64Codec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type Int16Codec added in v0.12.0

type Int16Codec struct{}

Int16Codec encodes/decodes int16.

func (*Int16Codec) Decode added in v0.12.0

func (c *Int16Codec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*Int16Codec) DescriptorID added in v0.12.0

func (c *Int16Codec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*Int16Codec) Encode added in v0.12.0

func (c *Int16Codec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*Int16Codec) Type added in v0.12.0

func (c *Int16Codec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type Int32Codec added in v0.12.0

type Int32Codec struct{}

Int32Codec encodes/decodes int32.

func (*Int32Codec) Decode added in v0.12.0

func (c *Int32Codec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*Int32Codec) DescriptorID added in v0.12.0

func (c *Int32Codec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*Int32Codec) Encode added in v0.12.0

func (c *Int32Codec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*Int32Codec) Type added in v0.12.0

func (c *Int32Codec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type Int64Codec added in v0.12.0

type Int64Codec struct{}

Int64Codec encodes/decodes int64.

func (*Int64Codec) Decode added in v0.12.0

func (c *Int64Codec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*Int64Codec) DescriptorID added in v0.12.0

func (c *Int64Codec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*Int64Codec) Encode added in v0.12.0

func (c *Int64Codec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*Int64Codec) Type added in v0.12.0

func (c *Int64Codec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type JSONCodec added in v0.12.0

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

JSONCodec encodes/decodes json.

func (*JSONCodec) Decode added in v0.12.0

func (c *JSONCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*JSONCodec) DescriptorID added in v0.12.0

func (c *JSONCodec) DescriptorID() types.UUID

func (*JSONCodec) Encode added in v0.12.0

func (c *JSONCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*JSONCodec) Type added in v0.12.0

func (c *JSONCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type LocalDateCodec added in v0.12.0

type LocalDateCodec struct{}

LocalDateCodec encodes/decodes LocalDate values.

func (*LocalDateCodec) Decode added in v0.12.0

func (c *LocalDateCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*LocalDateCodec) DescriptorID added in v0.12.0

func (c *LocalDateCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*LocalDateCodec) Encode added in v0.12.0

func (c *LocalDateCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*LocalDateCodec) Type added in v0.12.0

func (c *LocalDateCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type LocalDateTimeCodec added in v0.12.0

type LocalDateTimeCodec struct{}

LocalDateTimeCodec encodes/decodes LocalDateTime values.

func (*LocalDateTimeCodec) Decode added in v0.12.0

func (c *LocalDateTimeCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*LocalDateTimeCodec) DescriptorID added in v0.12.0

func (c *LocalDateTimeCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*LocalDateTimeCodec) Encode added in v0.12.0

func (c *LocalDateTimeCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*LocalDateTimeCodec) Type added in v0.12.0

func (c *LocalDateTimeCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type LocalTimeCodec added in v0.12.0

type LocalTimeCodec struct{}

LocalTimeCodec encodes/decodes LocalTime values.

func (*LocalTimeCodec) Decode added in v0.12.0

func (c *LocalTimeCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*LocalTimeCodec) DescriptorID added in v0.12.0

func (c *LocalTimeCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*LocalTimeCodec) Encode added in v0.12.0

func (c *LocalTimeCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*LocalTimeCodec) Type added in v0.12.0

func (c *LocalTimeCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type MemoryCodec added in v0.12.0

type MemoryCodec struct{}

MemoryCodec encodes/decodes Memory values.

func (*MemoryCodec) Decode added in v0.12.0

func (c *MemoryCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a value

func (*MemoryCodec) DescriptorID added in v0.12.0

func (c *MemoryCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*MemoryCodec) Encode added in v0.12.0

func (c *MemoryCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*MemoryCodec) Type added in v0.12.0

func (c *MemoryCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

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.

type RelativeDurationCodec added in v0.12.0

type RelativeDurationCodec struct{}

RelativeDurationCodec encodes/decodes RelativeDuration values.

func (*RelativeDurationCodec) Decode added in v0.12.0

func (c *RelativeDurationCodec) Decode(
	r *buff.Reader,
	out unsafe.Pointer,
) error

Decode decodes a value

func (*RelativeDurationCodec) DescriptorID added in v0.12.0

func (c *RelativeDurationCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*RelativeDurationCodec) Encode added in v0.12.0

func (c *RelativeDurationCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a value

func (*RelativeDurationCodec) Type added in v0.12.0

Type returns the type the codec encodes/decodes

type StrCodec added in v0.12.0

type StrCodec struct {
	ID types.UUID
}

StrCodec encodes/decodes strings.

func (*StrCodec) Decode added in v0.12.0

func (c *StrCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a string.

func (*StrCodec) DescriptorID added in v0.12.0

func (c *StrCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*StrCodec) Encode added in v0.12.0

func (c *StrCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a string.

func (*StrCodec) Type added in v0.12.0

func (c *StrCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

type UUIDCodec added in v0.12.0

type UUIDCodec struct{}

UUIDCodec encodes/decodes uuids.

func (*UUIDCodec) Decode added in v0.12.0

func (c *UUIDCodec) Decode(r *buff.Reader, out unsafe.Pointer) error

Decode decodes a uuid.

func (*UUIDCodec) DescriptorID added in v0.12.0

func (c *UUIDCodec) DescriptorID() types.UUID

DescriptorID returns the codecs descriptor id.

func (*UUIDCodec) Encode added in v0.12.0

func (c *UUIDCodec) Encode(
	w *buff.Writer,
	val interface{},
	path Path,
	required bool,
) error

Encode encodes a uuid.

func (*UUIDCodec) Type added in v0.12.0

func (c *UUIDCodec) Type() reflect.Type

Type returns the type the codec encodes/decodes

Jump to

Keyboard shortcuts

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