ChatiumFor developersPlaygroundPricing
Sign in

HeapTableRepo.getById

Returns a heap object by the provided unique identifier. Throws a NotFoundError if no record exists with that identifier.

Usage / Signature

const row = await table.getById(ctx, id)

Arguments

  • ctx: app.Ctx
    The request context. Used for internal implementation and allows executing the request in the appropriate transaction.
  • id: string
    The unique identifier of the required record.

Return Value: Promise<HeapObject>

Heap object with the specified identifier.

Examples

Fetching by Identifier

const Orgs = Heap.Table('orgs', {
  name: Heap.String(),
})
const org = await Orgs.getById(ctx, 'GfrQQ1xyYWndumSHlzp0chati')
ctx.console.log(org.name)