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.
Utilisation
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[]>Paramètres de type
| Nom | Contrainte | Par défaut |
|---|---|---|
T | — | — |
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
table | Table<T> | Oui | — |
options | QueryOptions<T> | Non | — Par défaut: {} |
Retourne
ReadonlySignal<T[]>
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.