Decode the column values pgoutput sends into Clojure data, keyed by type OID.
pgoutput renders columns in one of two formats per stream: every
column as its text representation (42, t, 2500.00), or
with the protocol-v2 binary option, each type's binary wire form
(int4 as four big-endian bytes, timestamps as microseconds since
2000-01-01, and so on — the layouts Postgres' typsend functions
emit, verified identical on servers 14-17). Relation messages name
each column's type only by OID, so both formats decode through an
OID-keyed lookup: decode-value dispatches on the value being a
string (text) or bytes (binary).
Values of unknown or custom types keep their raw text or bytes, and other values (NULL, unchanged-TOAST markers) pass through untouched.
Decode the column values pgoutput sends into Clojure data, keyed by type OID. pgoutput renders columns in one of two formats per stream: every column as its text representation (``42``, ``t``, ``2500.00``), or with the protocol-v2 ``binary`` option, each type's binary wire form (int4 as four big-endian bytes, timestamps as microseconds since 2000-01-01, and so on — the layouts Postgres' typsend functions emit, verified identical on servers 14-17). Relation messages name each column's type only by OID, so both formats decode through an OID-keyed lookup: [[decode-value]] dispatches on the value being a string (text) or bytes (binary). Values of unknown or custom types keep their raw text or bytes, and other values (NULL, unchanged-TOAST markers) pass through untouched.
(decode-value type-oid value)Decode one column value — text (string) or binary (bytes) — using
its column's type-oid. Non-string/non-bytes values pass through
untouched; unknown OIDs keep the raw text or bytes. This is the
function to hand a consumer as :value-decoder.
Decode one column `value` — text (string) or binary (bytes) — using its column's `type-oid`. Non-string/non-bytes values pass through untouched; unknown OIDs keep the raw text or bytes. This is the function to hand a consumer as ``:value-decoder``.
Marker for date and timestamp values Postgres renders as
infinity.
Marker for date and timestamp values Postgres renders as ``infinity``.
(parse-array-literal s)Parse an array's text form into nested vectors of strings and nils (unquoted NULL); typed decoding maps over the result.
Parse an array's text form into nested vectors of strings and nils (unquoted NULL); typed decoding maps over the result.
(parse-timestamp s)Timestamp without time zone -> LocalDateTime.
Timestamp without time zone -> LocalDateTime.
(parse-timestamptz s)Timestamp with time zone -> OffsetDateTime.
Timestamp with time zone -> OffsetDateTime.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |