Skip to main content
Version: v10.0.0

QueryDefinition

A query as data. Two queries with the same definition are the same query.


Import
import { QueryDefinition } from "@hyper-fetch/db"

Preview​

type QueryDefinition = {
collection: string;
joins?: { collection: string; field: string; name: string; on?: string; type?: inner }[];
limit?: number;
local: boolean;
one?: { key: RowKey };
orderBy: { direction: SortDirection; field: string }[];
select?: Record<string, string>;
where?: ExpressionNode;
}

Structure​

QueryDefinition
NameTypeDescription
collection
string
joins
{ collection: string; field: string; name: string; on?: string; type?: inner }[]

Left joins on another collection's key: each result carries the joined row under name

limit
number
local
boolean
one
{ key: RowKey }
orderBy
{ direction: SortDirection; field: string }[]
select
Record<string, string>

Output name to row field

where
ExpressionNode