Reference · SDK
techne.query(query, options?)
methodtechne-sdk/connectIn React, useRecordQuery
One page of a query, as items. The query sets the type, so techne.query(Place.query(…)) answers places.
A list across authors answers curated records, each with its byline. It answers valid items by default. include: 'all' adds the pending and invalid ones the platform answered. It never adds what the platform left out, which is records blocked, hidden or not admitted.
Parameters
| Name | Type | What it is |
|---|---|---|
queryrequired | Query<T> | A pub.techne.draft.query document, usually from a type's helper such as Place.query. |
options.params | { [name]: string } | The query's $param values, e.g. { here: '40.0150,-105.2705' }. |
options.include | 'valid' | 'all' | 'valid' (the default) or 'all'. |
options.limit | number | The page size. It defaults to the query's limit, else the platform's. |
options.cursor | string | The previous page's cursor. |
options.count | boolean | Also count what the query answers you. The page gains count and capped. |
Returns Page<T>
| Name | Type | What it is |
|---|---|---|
items | ValidItem<T>[] | In the query's order. With include: 'all', Item<T>[]. |
cursor | string | undefined | Pass it back for the next page. Absent on the last. |
count | number | undefined | How many records the query answers you, before include. Only with count. |
capped | boolean | undefined | True when counting stopped at the platform's cap. Only with count. |
Each item
uri | Uri<T> | The record's address. |
cid | string | The version's content hash. |
record | T | The record itself. |
verdict | 'valid' | 'pending' | 'invalid' | The SDK's own check of the record. |
problems | string[] | Why it is not valid, or what it waits for. |
curated | boolean | A curated record, composed from people's versions. |
byline | Byline | null | Whose version of a curated record speaks first. |
Places within 5 km, nearest first, and a count
The same read in React
useRecordQuery is useQuery(techne.queryOptions(query, options)).
Calls pub.techne.draft.query.listRecords → once for each page