Abstract
Interface whose fields are table names defining tables.
Name of the table.
Tuple of the names of the table's key columns.
Defaults to []
, indicating no key columns. Supports up to 4 columns.
Columns to return from selection queries.
Defaults to ['*']
, returning all columns. May specify aliases.
Type of objects returned by select queries.
Type of objects inserted into the table.
Type of objects used to update rows of the table.
Type of the count of the number of affected rows.
Columns to return from the table on insert
queries that return columns. ['*']
returns all columns; []
returns
none. May specify aliases. Defaults to KeyColumns
.
Columns to return from the table on update
queries that return columns. ['*']
returns all columns; []
returns
none and is the default. May specify aliases.
Type returned from inserts. Defaults to an object
whose properties are the columns of InsertReturnColumns
.
Type returned from updates. Defaults to an object
whose properties are the columns of UpdateReturnColumns
.
Constructs a new abstract table mapper.
The Kysely instance, either a database or a transaction.
The name of the table.
Optional
settings: Readonly<TableMapperSettings<DB, TB, KeyColumns, SelectedColumns, InsertReturnColumns, UpdateReturnColumns>>Settings governing mapper behavior. Default to selecting all columns and to returning no columns on insert or update.
Readonly
dbThe Kysely instance, either a database or a transaction.
Protected
Readonly
insertColumns to return from the table on insert.
Protected
Readonly
keyColumns that compose the table's primary key.
Protected
Readonly
selectedColumns to return from selection queries. []
=> all columns.
Readonly
settingsSettings governing mapper behavior.
Readonly
tableThe name of the table.
Protected
transformsQuery input and output value transforms.
Protected
Readonly
updateColumns to return from the table on update.
Returns a mapping query for deleting the rows of the table that match the provided filter or Kysely binary operation.
A mapping query for deleting rows.
Optional
filter: QueryFilter<DB, TB, KeyColumns, RE>Protected
getProtected
getProtected
getReturns a query builder for selecting rows from the table, caching the
query builder for use with future selection. The query builder returns
the columns and aliases specified in SelectedColumns
.
A query builder for selecting rows from the table.
Protected
getReturns a query for inserting rows into the table.
A mapping query for inserting rows.
Creates and returns a parameterized mapping query, which can be repeatedly executed with different parameter values, but which only ever compiles the underlying Kysely query once (on the first execution).
Function that receives an object of the form { mapper, param }
, where mapper
is the present table mapper and param
is a
function for creating parameters. The argument to param
is the name of
the parameter, which must occur as a property of Parameters
. You may
parameterize inserted values, updated values, and right-hand-side values
of filters. Parameters may not be arrays, but you can parameterize the
individual elements of an array. Returns a parameterized mapping query.
A parameterized mapping query
Parameters Record characterizing the available parameter names and types.
Returns a mapping query for selecting rows of the table that match the provided filter or Kysely binary operation.
A mapping query for retrieving rows as objects.
Optional
filter: QueryFilter<DB, TB, KeyColumns, RE>Returns a mapping query for updating rows of the table that match the provided filter or Kysely binary operation.
A mapping query for updating table rows.
Optional
filter: QueryFilter<DB, TB, KeyColumns, RE>Generated using TypeDoc
Abstract base class for table mappers. It is abstract because it does not provide a way to specify query input and output transforms. Custom table mappers should extend this class with means for providing transforms.