Veil
Basic Types: Integers and Ranges

Veil's basic types are those that do not contain repeating groups (arrays, hashes, etc).

Ranges, implemented by the type veil_range_t, consist of a pair of values and are generally used to initialise the bounds of array and bitmap types.

veil_range_t is defined as:

create type veil.veil_range_t as (
    min  int4,
    max  int4
);

Ranges may not contain nulls.

The int4 type is used to record a simple nullable integer. This is typically used to record the id of the connected user in a session.

The following functions comprise the Veil basic types API:

init_range(name text, min int4, max int4)

function veil.init_range(name text, min int4, max int4) returns int4

This, implemented by veil_init_range() defines a range, and returns the extent of that range.

range(name text)

function veil.range(name text) returns veil.range_t

This, implemented by C function veil_range() returns the contents of a range. It is intended primarily for interactive use.

int4_set(name text, value int4)

function veil.int4_set(name text, value int4) returns int4

Sets an int4 variable to a value, returning that same value. It is implemented by C function veil_int4_set().

int4_get(name text)

function veil.int4_get(name text) returns int4

Returns the value of the int4 variable given by name. Implemented by C function veil_int4_get().

Next: Bitmaps and Bitmap Refs