codecs

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 10 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 = &Bytes{strID, bytesType}
)

Functions

This section is empty.

Types

type Array

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

Array is an EdgeDB array type codec.

func (*Array) Decode

func (c *Array) Decode(r *buff.Reader, out reflect.Value)

Decode an array.

func (*Array) DecodePtr

func (c *Array) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes an array into an unsafe.Pointer.

func (*Array) DecodeReflect

func (c *Array) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes an array into a reflect.Value.

func (*Array) Encode

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

Encode an array.

func (*Array) ID

func (c *Array) ID() types.UUID

ID returns the descriptor id.

func (*Array) Type

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

Type returns the reflect.Type that this codec decodes to.

type BigInt

type BigInt struct{}

BigInt is and EdgeDB bigint type codec.

func (*BigInt) Decode

func (c *BigInt) Decode(r *buff.Reader, out reflect.Value)

Decode a bigint.

func (*BigInt) DecodePtr

func (c *BigInt) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a bigint into an unsafe.Pointer.

func (*BigInt) DecodeReflect

func (c *BigInt) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a bigint into a reflect.Value.

func (*BigInt) Encode

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

Encode a bigint.

func (*BigInt) ID

func (c *BigInt) ID() types.UUID

ID returns the descriptor id.

func (*BigInt) Type

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

Type returns the reflect.Type that this codec decodes to.

type Bool

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

Bool is an EdgeDB bool type codec.

func (*Bool) Decode

func (c *Bool) Decode(r *buff.Reader, out reflect.Value)

Decode a bool.

func (*Bool) DecodePtr

func (c *Bool) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a bool into an unsafe.Pointer.

func (*Bool) DecodeReflect

func (c *Bool) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a bool into a reflect.Value.

func (*Bool) Encode

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

Encode a bool.

func (*Bool) ID

func (c *Bool) ID() types.UUID

ID returns the descriptor id.

func (*Bool) Type

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

Type returns the reflect.Type that this codec decodes to.

type Bytes

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

Bytes is an EdgeDB bytes type codec.

func (*Bytes) Decode

func (c *Bytes) Decode(r *buff.Reader, out reflect.Value)

Decode []byte.

func (*Bytes) DecodePtr

func (c *Bytes) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes bytes into an unsafe.Pointer.

func (*Bytes) DecodeReflect

func (c *Bytes) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes bytes into a reflect.Value.

func (*Bytes) Encode

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

Encode []byte.

func (*Bytes) ID

func (c *Bytes) ID() types.UUID

ID returns the descriptor id.

func (*Bytes) Type

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

Type returns the reflect.Type that this codec decodes to.

type Codec

type Codec interface {
	Decode(*buff.Reader, reflect.Value)
	DecodeReflect(*buff.Reader, reflect.Value, Path)
	DecodePtr(*buff.Reader, unsafe.Pointer)
	Encode(*buff.Writer, interface{}, Path) error
	ID() types.UUID
	Type() reflect.Type
	// contains filtered or unexported methods
}

Codec interface

func BuildCodec

func BuildCodec(r *buff.Reader) (Codec, error)

BuildCodec a decoder

func BuildTypedCodec

func BuildTypedCodec(r *buff.Reader, typ reflect.Type) (Codec, error)

BuildTypedCodec builds a codec for decoding into a specific type.

type DateTime

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

DateTime is an EdgeDB datetime type codec.

func (*DateTime) Decode

func (c *DateTime) Decode(r *buff.Reader, out reflect.Value)

Decode a datetime.

func (*DateTime) DecodePtr

func (c *DateTime) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a datetime into an unsafe.Pointer.

func (*DateTime) DecodeReflect

func (c *DateTime) DecodeReflect(
	r *buff.Reader,
	out reflect.Value,
	path Path,
)

DecodeReflect decodes a datetime into a reflect.Value.

func (*DateTime) Encode

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

Encode a datetime.

func (*DateTime) ID

func (c *DateTime) ID() types.UUID

ID returns the descriptor id.

func (*DateTime) Type

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

Type returns the reflect.Type that this codec decodes to.

type Duration

type Duration struct{}

Duration is an EdgeDB duration codec.

func (*Duration) Decode

func (c *Duration) Decode(r *buff.Reader, out reflect.Value)

Decode a duration.

func (*Duration) DecodePtr

func (c *Duration) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a duration into an unsafe.Pointer.

func (*Duration) DecodeReflect

func (c *Duration) DecodeReflect(
	r *buff.Reader,
	out reflect.Value,
	path Path,
)

DecodeReflect decodes a duration into a reflect.Value.

func (*Duration) Encode

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

Encode a duration.

func (*Duration) ID

func (c *Duration) ID() types.UUID

ID returns the descriptor id.

func (*Duration) Type

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

Type returns the reflect.Type that this codec decodes to.

type Float32

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

Float32 is an EdgeDB float32 type codec.

func (*Float32) Decode

func (c *Float32) Decode(r *buff.Reader, out reflect.Value)

Decode a float32.

func (*Float32) DecodePtr

func (c *Float32) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a float32 into an unsafe.Pointer.

func (*Float32) DecodeReflect

func (c *Float32) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a float32 into a reflect.Value.

func (*Float32) Encode

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

Encode a float32.

func (*Float32) ID

func (c *Float32) ID() types.UUID

ID returns the descriptor id.

func (*Float32) Type

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

Type returns the reflect.Type that this codec decodes to.

type Float64

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

Float64 is an EdgeDB float64 type codec.

func (*Float64) Decode

func (c *Float64) Decode(r *buff.Reader, out reflect.Value)

Decode a float64.

func (*Float64) DecodePtr

func (c *Float64) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a float64 into an unsafe.Pointer.

func (*Float64) DecodeReflect

func (c *Float64) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a float64 into a reflect.Value.

func (*Float64) Encode

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

Encode a float64.

func (*Float64) ID

func (c *Float64) ID() types.UUID

ID returns the descriptor id.

func (*Float64) Type

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

Type returns the reflect.Type that this codec decodes to.

type Int16

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

Int16 is an EdgeDB int64 type codec.

func (*Int16) Decode

func (c *Int16) Decode(r *buff.Reader, out reflect.Value)

Decode an int16.

func (*Int16) DecodePtr

func (c *Int16) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes an int16 into an unsafe.Pointer.

func (*Int16) DecodeReflect

func (c *Int16) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes an int16 into a reflect.Value.

func (*Int16) Encode

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

Encode an int16.

func (*Int16) ID

func (c *Int16) ID() types.UUID

ID returns the descriptor id.

func (*Int16) Type

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

Type returns the reflect.Type that this codec decodes to.

type Int32

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

Int32 is an EdgeDB int32 type codec.

func (*Int32) Decode

func (c *Int32) Decode(r *buff.Reader, out reflect.Value)

Decode an int32.

func (*Int32) DecodePtr

func (c *Int32) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes an int32 into an unsafe.Pointer.

func (*Int32) DecodeReflect

func (c *Int32) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes an int32 into a reflect.Value.

func (*Int32) Encode

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

Encode an int32.

func (*Int32) ID

func (c *Int32) ID() types.UUID

ID returns the descriptor id.

func (*Int32) Type

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

Type returns the reflect.Type that this codec decodes to.

type Int64

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

Int64 is an EdgeDB int64 type codec.

func (*Int64) Decode

func (c *Int64) Decode(r *buff.Reader, out reflect.Value)

Decode an int64.

func (*Int64) DecodePtr

func (c *Int64) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes an int64 into an unsafe.Pointer.

func (*Int64) DecodeReflect

func (c *Int64) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes an int64 into a reflect.Value.

func (*Int64) Encode

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

Encode an int64.

func (*Int64) ID

func (c *Int64) ID() types.UUID

ID returns the descriptor id.

func (*Int64) Type

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

Type returns the reflect.Type that this codec decodes to.

type JSON

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

JSON is an EdgeDB json type codec.

func (*JSON) Decode

func (c *JSON) Decode(r *buff.Reader, out reflect.Value)

Decode json.

func (*JSON) DecodePtr

func (c *JSON) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes JSON into an unsafe.Pointer.

func (*JSON) DecodeReflect

func (c *JSON) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes JSON into a reflect.Value.

func (*JSON) Encode

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

Encode json.

func (*JSON) ID

func (c *JSON) ID() types.UUID

ID returns the descriptor id.

func (*JSON) Type

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

Type returns the reflect.Type that this codec decodes to.

type LocalDate

type LocalDate struct{}

LocalDate is an EdgeDB cal::local_date codec

func (*LocalDate) Decode

func (c *LocalDate) Decode(r *buff.Reader, out reflect.Value)

Decode a LocalDate

func (*LocalDate) DecodePtr

func (c *LocalDate) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a LocalDate into an unsafe.Pointer.

func (*LocalDate) DecodeReflect

func (c *LocalDate) DecodeReflect(
	r *buff.Reader,
	out reflect.Value,
	path Path,
)

DecodeReflect decodes a LocalDateTime using reflection

func (*LocalDate) Encode

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

Encode a LocalDate

func (*LocalDate) ID

func (c *LocalDate) ID() types.UUID

ID returns the descriptor id.

func (*LocalDate) Type

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

Type returns the reflect.Type that this codec decodes to.

type LocalDateTime

type LocalDateTime struct{}

LocalDateTime is an EdgeDB cal::local_datetime codec

func (*LocalDateTime) Decode

func (c *LocalDateTime) Decode(r *buff.Reader, out reflect.Value)

Decode a LocalDateTime

func (*LocalDateTime) DecodePtr

func (c *LocalDateTime) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a LocalDateTime into an unsafe.Pointer.

func (*LocalDateTime) DecodeReflect

func (c *LocalDateTime) DecodeReflect(
	r *buff.Reader,
	out reflect.Value,
	path Path,
)

DecodeReflect decodes a LocalDateTime using reflection

func (*LocalDateTime) Encode

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

Encode a LocalDateTime

func (*LocalDateTime) ID

func (c *LocalDateTime) ID() types.UUID

ID returns the descriptor id.

func (*LocalDateTime) Type

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

Type returns the reflect.Type that this codec decodes to.

type LocalTime

type LocalTime struct{}

LocalTime is an EdgeDB cal::local_time codec

func (*LocalTime) Decode

func (c *LocalTime) Decode(r *buff.Reader, out reflect.Value)

Decode a LocalTime

func (*LocalTime) DecodePtr

func (c *LocalTime) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a LocalTime into an unsafe.Pointer.

func (*LocalTime) DecodeReflect

func (c *LocalTime) DecodeReflect(
	r *buff.Reader,
	out reflect.Value,
	path Path,
)

DecodeReflect decodes a LocalTimeTime using reflection

func (*LocalTime) Encode

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

Encode a LocalTime

func (*LocalTime) ID

func (c *LocalTime) ID() types.UUID

ID returns the descriptor id.

func (*LocalTime) Type

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

Type returns the reflect.Type that this codec decodes to.

type NamedTuple

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

NamedTuple is an EdgeDB namedtuple type codec.

func (*NamedTuple) Decode

func (c *NamedTuple) Decode(r *buff.Reader, out reflect.Value)

Decode a named tuple.

func (*NamedTuple) DecodePtr

func (c *NamedTuple) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a named tuple into an unsafe.Pointer.

func (*NamedTuple) DecodeReflect

func (c *NamedTuple) DecodeReflect(
	r *buff.Reader,
	out reflect.Value,
	path Path,
)

DecodeReflect decodes a named tuple into a reflect.Value.

func (*NamedTuple) Encode

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

Encode a named tuple.

func (*NamedTuple) ID

func (c *NamedTuple) ID() types.UUID

ID returns the descriptor id.

func (*NamedTuple) Type

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

Type returns the reflect.Type that this codec decodes to.

type Object

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

Object is an EdgeDB object type codec.

func (*Object) Decode

func (c *Object) Decode(r *buff.Reader, out reflect.Value)

Decode an object

func (*Object) DecodePtr

func (c *Object) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes an object into an unsafe.Pointer.

func (*Object) DecodeReflect

func (c *Object) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes an object into a reflect.Value.

func (*Object) Encode

func (c *Object) Encode(buf *buff.Writer, val interface{}, path Path) error

Encode an object

func (*Object) ID

func (c *Object) ID() types.UUID

ID returns the descriptor id.

func (*Object) Type

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

Type returns the reflect.Type that this codec decodes to.

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 Set

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

Set is an EdgeDB set type codec.

func (*Set) Decode

func (c *Set) Decode(r *buff.Reader, out reflect.Value)

Decode a set

func (*Set) DecodePtr

func (c *Set) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a set into an unsafe.Pointer.

func (*Set) DecodeReflect

func (c *Set) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a set into a reflect.Value.

func (*Set) Encode

func (c *Set) Encode(buf *buff.Writer, val interface{}, path Path) error

Encode a set

func (*Set) ID

func (c *Set) ID() types.UUID

ID returns the descriptor id.

func (*Set) Type

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

Type returns the reflect.Type that this codec decodes to.

type Str

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

Str is an EdgeDB string type codec.

func (*Str) Decode

func (c *Str) Decode(r *buff.Reader, out reflect.Value)

Decode a string.

func (*Str) DecodePtr

func (c *Str) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a str into an unsafe.Pointer.

func (*Str) DecodeReflect

func (c *Str) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a str into a reflect.Value.

func (*Str) Encode

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

Encode a string.

func (*Str) ID

func (c *Str) ID() types.UUID

ID returns the descriptor id.

func (*Str) Type

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

Type returns the reflect.Type that this codec decodes to.

type Tuple

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

Tuple is an EdgeDB tuple type codec.

func (*Tuple) Decode

func (c *Tuple) Decode(r *buff.Reader, out reflect.Value)

Decode a tuple.

func (*Tuple) DecodePtr

func (c *Tuple) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a tuple into an unsafe.Pointer.

func (*Tuple) DecodeReflect

func (c *Tuple) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a tuple into a reflect.Value.

func (*Tuple) Encode

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

Encode a tuple.

func (*Tuple) ID

func (c *Tuple) ID() types.UUID

ID returns the descriptor id.

func (*Tuple) Type

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

Type returns the reflect.Type that this codec decodes to.

type UUID

type UUID struct{}

UUID is an EdgeDB UUID type codec.

func (*UUID) Decode

func (c *UUID) Decode(r *buff.Reader, out reflect.Value)

Decode a UUID.

func (*UUID) DecodePtr

func (c *UUID) DecodePtr(r *buff.Reader, out unsafe.Pointer)

DecodePtr decodes a UUID into an unsafe.Pointer.

func (*UUID) DecodeReflect

func (c *UUID) DecodeReflect(r *buff.Reader, out reflect.Value, path Path)

DecodeReflect decodes a UUID using reflection

func (*UUID) Encode

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

Encode a UUID.

func (*UUID) ID

func (c *UUID) ID() types.UUID

ID returns the descriptor id.

func (*UUID) Type

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

Type returns the reflect.Type that this codec decodes to.

Jump to

Keyboard shortcuts

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