db.query
The rows of table that options select, as a signal: read synchronously
at first, then again on the background thread after each write to the table.
Utilização
Reuse a filter when querying a typed table.
// 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' } });
}Assinaturas
<T>(table: Table<T>, options?: QueryOptions<T>): ReadonlySignal<T[]>Parâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
T | — | — |
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
table | Table<T> | Sim | — |
options | QueryOptions<T> | Não | — Predefinição: {} |
Devolve
ReadonlySignal<T[]>
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.