Usage

Reuse a filter when querying a typed table.

tsx
// 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

ts
<T>(table: Table<T>, options?: QueryOptions<T>): ReadonlySignal<T[]>

Type parameters

NameConstraintDefault
T——

Parameters

NameTypeRequiredDescription
tableTable<T>Yes—
optionsQueryOptions<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.