Postgrex.Extension behaviour

An extension knows how to encode and decode Postgres types to and from Elixir values.

Source

Types

t :: module

opts :: term

Callbacks

decode/4

Specs:

Should decode a binary in the specified Postgres protocol format to an Elixir value.

Source
encode/4

Specs:

Should encode an Elixir value to a binary in the specified Postgres protocol format.

Source
format/1

Specs:

  • format(opts) :: :binary | :text

Returns the format the type should be encoded as. See http://www.postgresql.org/docs/9.4/static/protocol-overview.html#PROTOCOL-FORMAT-CODES.

Source
init/2

Specs:

Should perform any initialization of the extension. The function receives the server parameters (http://www.postgresql.org/docs/9.4/static/runtime-config.html) and user options. The options returned from this function will be passed to all other callbacks.

Source
matching/1

Specs:

Specifies the types the extension matches, see Postgrex.TypeInfo for specification of the fields.

Source