# 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.

```gizlang
import * as Lsn from "gizmodel/sql/types/lsn";
```

## Functions

### `lsnDeclared`

```gizlang
function lsnDeclared(declared: string): bool
```

Whether a declared type is pg_lsn.

Effects: fail, alloc.

### `lsnResultOf`

```gizlang
function lsnResultOf(op: string): string
```

The declared type of lsnApply's result for `op`: PG_LSN, NUMERIC, TEXT or BOOLEAN.

### `lsnCast`

```gizlang
function lsnCast(v: Value): Value throws DbError
```

A cast to pg_lsn: text is read, a number is a position (pg_lsn(numeric)).

Effects: fail, alloc.

### `lsnApply`

```gizlang
function lsnApply(op: string, args: Vec<Value>): Value throws DbError
```

An 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.

