Postgrex v0.12.2 Postgrex.Extensions.JSON View Source
An extension that supports the json
and jsonb
types.
This extension is not used by default, it needs to be included in the
:extensions
option to Postgrex.start_link/1
.
Options
:library
- The module to encode and decode JSON binaries, callsmodule.encode!/1
to encode andmodule.decode!/1
to decode (required);:decode_binary
- Either:copy
to copy binary values before decoding with the library module or:reference
to use a reference counted binary of the binary received from the socket. Referencing a potentially larger binary can be more efficient if the binary value is going to be garbaged collected soon because a copy is avoided. However the larger binary can not be garbage collected until all references are garbage collected (defaults to:copy
);
Link to this section Summary
Functions
Should decode a binary in the specified Postgres protocol format to an Elixir value
Should encode an Elixir value to a binary in the specified Postgres protocol format
Returns the format the type should be encoded as. See http://www.postgresql.org/docs/9.4/static/protocol-overview.html#PROTOCOL-FORMAT-CODES
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
Specifies the types the extension matches, see Postgrex.TypeInfo
for
specification of the fields
Link to this section Functions
Should decode a binary in the specified Postgres protocol format to an Elixir value.
Callback implementation for Postgrex.Extension.decode/4
.
Should encode an Elixir value to a binary in the specified Postgres protocol format.
Callback implementation for Postgrex.Extension.encode/4
.
Returns the format the type should be encoded as. See http://www.postgresql.org/docs/9.4/static/protocol-overview.html#PROTOCOL-FORMAT-CODES.
Callback implementation for Postgrex.Extension.format/1
.
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.
Callback implementation for Postgrex.Extension.init/2
.
Specifies the types the extension matches, see Postgrex.TypeInfo
for
specification of the fields.
Callback implementation for Postgrex.Extension.matching/1
.