QueryOptions
Selects the rows a database query returns: which ones match, their order, and how many.
Usage
Reuse a filter when querying a typed table.
This type is used by db.query
// Reuse a filter when querying a typed table.
import { db, type Comparison, type Table } from 'kuito';
type Product = { id: string; price: number };
export function affordableProducts(products: Table<Product>) {
const price: Comparison<number> = { gte: 0, lte: 50 };
return db.query(products, { where: { price }, orderBy: { price: 'asc' } });
}Type declaration
export interface QueryOptions<T> {
where?: Where<T>;
/** Columns to sort by, the first first. */
orderBy?: { readonly [K in Column<T>]?: 'asc' | 'desc' };
limit?: number;
}Members 3
| Name | Type | Required | Description |
|---|---|---|---|
where | Where<T> | No | — |
orderBy | { readonly [K in Column<T>]?: "asc" | "desc"; } | No | Columns to sort by, the first first. |
limit | number | No | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.