View Source EdgeDB.Protocol.Codec behaviour (EdgeDB v0.1.0)
A codec structure knows how to work with the internal binary data from EdgeDB.
The binary protocol specification for the codecs can be found on the official EdgeDB site.
Useful links for codec developers:
Link to this section Summary
Types
Options for defining custom codecs with EdgeDB.Protocol.Codec.defscalarcodec/1
.
Function that can decode EdgeDB binary format into an entity.
Function that can encode an entity to EdgeDB binary format.
A codec structure knows how to work with the internal binary data from EdgeDB.
UUID value.
Callbacks
Decode binary data from EdgeDB format to the expected entity.
Encode the entity into EdgeDB binary format.
Functions
Decode EdgeDB binary data into an enitity using the codec.
Macros for defining custom scalar codecs implementation.
Encode an entity into EdgeDB binary format using the codec.
Link to this section Types
Specs
Options for defining custom codecs with EdgeDB.Protocol.Codec.defscalarcodec/1
.
Supported options:
:type
- typepec for the type that can be processed by the encoder/decoder function.:type_name
- the name of the EdgeDB type that can be processed by codec.:calculate_size
- flag specifying whether to automatically calculate the payload size for the encoder/decoder.
Specs
Function that can decode EdgeDB binary format into an entity.
Specs
Function that can encode an entity to EdgeDB binary format.
Specs
t() :: %EdgeDB.Protocol.Codec{ decoder: decoder(), encoder: encoder(), is_scalar: boolean(), module: module(), parent: module() | nil, type_id: uuid() | nil, type_name: String.t() | nil }
A codec structure knows how to work with the internal binary data from EdgeDB.
Fields:
:type_id
- EdgeDB type ID that can be encoded/decoded by the codec.:type_name
- optional name of the type that can be encoded/decoded by the codec.:encoder
- function that can encode an entity to EdgeDB binary format.:decoder
- function that can decode EdgeDB binary format into an entity.:module
- module which defines the implementation of the codec.:parent
- module, which was used as the base for the implementation of the codec.:is_scalar
- flag specifying that the codec is used to encode/decode EdgeDB scalar values.
Specs
uuid() :: String.t()
UUID value.
Link to this section Callbacks
Specs
Decode binary data from EdgeDB format to the expected entity.
Specs
Encode the entity into EdgeDB binary format.
Link to this section Functions
Specs
Decode EdgeDB binary data into an enitity using the codec.
Specs
defscalarcodec([codec_option()]) :: Macro.t()
Macros for defining custom scalar codecs implementation.
See custom codecs development guide for more information.
Specs
Encode an entity into EdgeDB binary format using the codec.