Skip to main content

Read one object

A point addresses one fact by its key, or by a unique field set:
ctx.get answers the fact or null. customers({ email }) reads by a unique: [["email"]] set, and stock({ warehouse, sku }) by a declared multi-field key. Use .pick("name", "email") on the point to read fewer fields, which also narrows the read set. ctx.has(point) answers only whether the fact is present, which can carry a lower label than the fact.

Read many

  • ctx.list(selection.first(n)) reads all of a bounded selection.
  • ctx.page(selection, { size, cursor }) reads one window and answers { facts, next }; pass next back as cursor.
  • ctx.count(selection) answers the exact number of facts.
Pass the requested size through to ctx.page. The kernel refuses an oversized page with Limit. An API with a smaller window declares that bound in its size argument.

From the client

In React, useWatch(api<typeof App>().customers.customer, { id }) keeps the value current, and usePages holds the pages of a paging query. See Reading.