resource
resource(
name):ResourceBuilder<{ },never>
Defined in: packages/schema/src/resource.ts:251
A resource: one table of an existing database, its columns as fields, its key and the rules around it. name is its
address (/api/v1/<name>) and how other config refers to it. See
Data config.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”ResourceBuilder<{ }, never>
Example
Section titled “Example”export const customers = resource('customers') .table('shop.customers') .fields({ id: f.integer().readOnly().filterable().sortable().dbDefault(), name: f.text().min(2).filterable().sortable(), email: f.text().optional().filterable(), }) .primaryKey((r) => r.id) .search((r) => [r.name, r.email])