gizmodel/sql/types/inet
PostgreSQL's network address types inet and cidr as PostgreSQL 16's network.c and inet_net_pton.c read, write and compare them. A value is the text of its canonical output; the binder sends each operator and function of these types to inetApply, which reads the text again.
import * as Inet from "gizmodel/sql/types/inet";Functions
inetKindOf
function inetKindOf(declared: string): stringThe network type a declared type names, lower case, or "".
Effects: fail, alloc.
inetFunction
function inetFunction(name: string): boolThe functions of inet and cidr values that inetApply evaluates.
Effects: fail, alloc.
inetResultOf
function inetResultOf(op: string): stringThe declared type of inetApply's result for op: INET, CIDR, TEXT, INTEGER, BIGINT or BOOLEAN.
inetInput
function inetInput(kind: string, text: string): string throws DbErrorReads text as a value of kind (inet or cidr) and returns its canonical text (network_in).
Effects: fail, alloc.
inetApply
function inetApply(op: string, args: Vec<Value>): Value throws DbErrorThe operator or function op (inetResultOf names its result) of inet and cidr values; a null argument gives null.
Effects: fail, alloc.
inetBinary
function inetBinary(text: string, cidr: bool): Option<bytes>The binary form of a value (inet_send): family, mask length, whether cidr, address length, address bytes.
Effects: fail, alloc.
macKindOf
function macKindOf(declared: string): stringThe MAC address type a declared type names, lower case, or "".
Effects: fail, alloc.
netKindOf
function netKindOf(declared: string): stringThe network or MAC address type a declared type names, lower case, or "".
Effects: fail, alloc.
macResultOf
function macResultOf(op: string, kind: string): stringThe declared type of macApply's result for op.
Effects: fail, alloc.
macApply
function macApply(op: string, kind: string, args: Vec<Value>): Value throws DbErrorThe operator, function or cast op of MAC addresses of type kind: ~ & | trunc set7bit, the comparisons and the
casts macaddr and macaddr8. Text arguments read as kind; a null argument gives null.
Effects: fail, alloc.