gizmodel/sql/types/lsn
PostgreSQL's pg_lsn type as PostgreSQL 16's pg_lsn.c reads, writes and computes it. A value is the text of its canonical output (hex high word, a slash, hex low word); the binder sends each operator of the type to lsnApply, which reads the text again.
import * as Lsn from "gizmodel/sql/types/lsn";Functions
lsnDeclared
function lsnDeclared(declared: string): boolWhether a declared type is pg_lsn.
Effects: fail, alloc.
lsnResultOf
function lsnResultOf(op: string): stringThe declared type of lsnApply's result for op: PG_LSN, NUMERIC, TEXT or BOOLEAN.
lsnCast
function lsnCast(v: Value): Value throws DbErrorA cast to pg_lsn: text is read, a number is a position (pg_lsn(numeric)).
Effects: fail, alloc.
lsnApply
function lsnApply(op: string, args: Vec<Value>): Value throws DbErrorAn operator of pg_lsn values: "key" (text that orders as the positions), comparisons, "-" of two positions (a numeric), and "+n" and "-n" of a position and a numeric.
Effects: fail, alloc.