hierarch v0.2.0 Hierarch.Postgrex.Extensions.LTree View Source
Link to this section Summary
Functions
Returns a quoted list of clauses that decode a binary to an Elixir value.
Returns a quoted list of clauses that encode an Elixir value to iodata.
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 user options. The state returned from this function will be passed to other callbacks.
Specifies the types the extension matches, see Postgrex.TypeInfo
for
specification of the fields.
Link to this section Functions
decode(atom) View Source
Returns a quoted list of clauses that decode a binary to an Elixir value.
The pattern must use binary syntax and decode a fixed length using the signed 32 bit big endian integer byte length header.
def decode(_) do
quote do
# length header is in bytes
<<len :: signed-32, integer :: signed-size(len)-unit(8)>> ->
integer
end
end
Callback implementation for Postgrex.Extension.decode/1
.
encode(state) View Source
Returns a quoted list of clauses that encode an Elixir value to iodata.
It must use a signed 32 bit big endian integer byte length header.
def encode(_) do
quote do
integer ->
<<8 :: signed-32, integer :: signed-64>>
end
end
Callback implementation for Postgrex.Extension.encode/1
.
format(state) View Source
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
.
init(opts) View Source
Should perform any initialization of the extension. The function receives the user options. The state returned from this function will be passed to other callbacks.
Callback implementation for Postgrex.Extension.init/1
.
matching(state) View Source
Specifies the types the extension matches, see Postgrex.TypeInfo
for
specification of the fields.
Callback implementation for Postgrex.Extension.matching/1
.