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.
Usage
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' } });
}Signatures
<T>(table: Table<T>, options?: QueryOptions<T>): ReadonlySignal<T[]>Type parameters
| Name | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
table | Table<T> | Yes | — |
options | QueryOptions<T> | No | — Default: {} |
Returns
ReadonlySignal<T[]>
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.