The wire form of the column types Postgrex returns as a struct of its own: how the exporters write one and how the importers read it back, for the REST and the WebSocket paths alike.
Carried, as text the importer turns back into the same value:
| Column type | Struct | Text |
|---|---|---|
interval | Postgrex.Interval | "14 mons 3 days 14706000007 microseconds" |
inet, cidr | Postgrex.INET | "10.0.0.1", "10.0.0.0/8", "::1/128" |
macaddr | Postgrex.MACADDR | "08:00:2b:01:02:03" |
An interval's three parts are written as Postgres stores them (months, days and microseconds are not folded into one another), in whole numbers, so nothing is rounded.
Not carried: ranges and multiranges, the geometric types (point,
line, lseg, box, path, polygon, circle) and tsvector (a
list of Postgrex.Lexeme, marked by its first element). The
exporter writes %{"__phoenix_kit_unsupported__" => "Postgrex.Range"} in
place of such a value, and the importer fails that record, naming the
type, instead of storing text that only looks like the value.
Summary
Functions
Reads the text serialize/1 wrote for a column of type back into the
struct Postgrex binds: {:ok, struct}, or :error for text that is not
that type's.
Writes a struct Postgrex returned for a column value: its text for a type this module carries, the unsupported marker for any other struct.
The type named by an unsupported marker, or nil for any other value.
The unsupported marker for a value that has no wire form and is not a
struct (a composite column's tuple, a bit(n) bitstring), named by
label.
Functions
Reads the text serialize/1 wrote for a column of type back into the
struct Postgrex binds: {:ok, struct}, or :error for text that is not
that type's.
Writes a struct Postgrex returned for a column value: its text for a type this module carries, the unsupported marker for any other struct.
@spec types() :: [String.t()]
The column types parse/2 reads.
The type named by an unsupported marker, or nil for any other value.
The unsupported marker for a value that has no wire form and is not a
struct (a composite column's tuple, a bit(n) bitstring), named by
label.