TableRunner.prepare() method
Home > @direct-sqlite/core > TableRunner > prepare
TableRunner.prepare() method
Section titled “TableRunner.prepare() method”Pre-compiles execution statement structures bypassing standard lookup evaluations during fast loops.
Signature:
prepare<K extends keyof TRow>(action: 'SELECT' | 'DELETE', column: K, operator: ComparisonOperator): { all: (...params: TRow[K][]) => TRow[]; get: (...params: TRow[K][]) => TRow | undefined; run: (...params: TRow[K][]) => any; };Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
action |
‘SELECT’ | ‘DELETE’ |
The type of query to prepare, either ‘SELECT’ or ‘DELETE’. |
|
column |
K |
The column name to apply the WHERE condition on. Should be a key of the table’s row type. |
|
operator |
ComparisonOperator |
The comparison operator to use in the WHERE condition. Should be one of the defined ComparisonOperator types. |
Returns:
{ all: (…params: TRow[K][]) => TRow[]; get: (…params: TRow[K][]) => TRow | undefined; run: (…params: TRow[K][]) => any; }
Either a SelectQueryBuilder instance for building and executing the SELECT query or a MutationBuilder instance for building and executing the DELETE query, depending on the specified action parameter.