Skip to content

f

const f: object

Defined in: packages/schema/src/fields.ts:49

The field builders of a resource’s .fields({ ... }), one per field type. Each returns a Field whose options chain in any order. See Field types.

bigint: () => Field<string>

A 64-bit integer: an int8 column, a string in the API so that all 64 bits survive.

Field<string>

boolean: () => Field<boolean>

A bool column.

Field<boolean>

country: () => Field<string>

An ISO 3166-1 alpha-2 country code such as NL, in a text column.

Field<string>

currency: () => Field<string>

An ISO 4217 currency code such as EUR, in a text column.

Field<string>

date: () => Field<string>

A date column, 2026-10-08 in the API.

Field<string>

decimal: (o) => Field<string>

An exact decimal of precision digits, scale of them after the point: a numeric column, a string in the API.

number

number

Field<string>

enum: <T>(values) => Field<T[number]>

One of values: a Postgres enum, or text with a CHECK (... IN ...). The record type is the union of the values.

T extends readonly string[]

T

Field<T[number]>

file: () => FileField<string>

A file: its column holds {provider}:{path}?name=…&size=… as text, and responses carry { uri, name, type, size, url }.

FileField<string>

integer: () => Field<number>

A 32-bit or smaller integer: an int2 or int4 column. Takes .min() and .max().

Field<number>

json: () => Field<JSONType>

Any JSON: a json or jsonb column.

Field<JSONType>

relation: (resource) => RelationField<string | number>

The key of a record of resource, in that resource’s key column(s); the admin shows the other record’s title and links to it. A relation to a resource with a key of several columns names them with .columns().

string

RelationField<string | number>

text: () => Field<string>

Text: a text, varchar or bpchar column. Takes .min(), .max() (length) and .regex().

Field<string>

timestamp: () => Field<string>

A timestamp or timestamptz column, ISO 8601 with an offset in the API.

Field<string>

uuid: () => Field<string>

A uuid column.

Field<string>

.fields({
id: f.integer().readOnly().filterable().sortable().dbDefault(),
status: f.enum(['booked', 'ready', 'collected']).default('booked').filterable(),
customer_id: f.relation('customers').filterable(),
estimate: f.decimal({ precision: 8, scale: 2 }),
notes: f.text().optional().column('internal_notes'),
})