QueryOptions
Selects the rows a database query returns: which ones match, their order, and how many.
Utilização
Reuse a filter when querying a typed table.
Este tipo é usado por 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' } });
}Declaração do tipo
export interface QueryOptions<T> {
where?: Where<T>;
/** Columns to sort by, the first first. */
orderBy?: { readonly [K in Column<T>]?: 'asc' | 'desc' };
limit?: number;
}Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
where | Where<T> | Não | — |
orderBy | { readonly [K in Column<T>]?: "asc" | "desc"; } | Não | Columns to sort by, the first first. |
limit | number | Não | — |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.