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.
Verwendung
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' } });
}Signaturen
<T>(table: Table<T>, options?: QueryOptions<T>): ReadonlySignal<T[]>Typparameter
| Name | Einschränkung | Standard |
|---|---|---|
T | — | — |
Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
table | Table<T> | Ja | — |
options | QueryOptions<T> | Nein | — Standard: {} |
Rückgabe
ReadonlySignal<T[]>
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.