ChatiumFor developersPlaygroundPricing
Sign in

HeapTableRepo - CRUD API

To read and write data to a heap table, you should use the repository object returned by the function Heap.Table. Below are all the available methods and properties of the repository:

Reading Methods

  • getById — returns a heap record (or heap object) by the provided unique identifier. Throws an error if no record with that identifier exists.

    • findById — returns a heap object by the provided unique identifier. Unlike getById, it returns null if the record does not exist.
    • findByIds — returns an array of heap objects for the provided list of unique identifiers.
  • findAll — a universal way to query heap table objects. Returns either all records or those with specified filtering, sorting, and limits (where, order, limit, offset).

    • findBy — a "shortened" version of findAll, supporting only filtering.
    • findOneBy — returns only the first record from the filtered list or null.
  • countBy — returns the number of records that match the given filter.

Writing Methods

  • create — creates a new record in the table.
  • update — modifies/edits an existing record in the table by the given
    • updateAll — bulk modifies/edits existing records in the table by the given identifier. Throws an error if such a record does not exist.
    • updateMaybe — modifies/edits an existing record in the table by the given identifier. Unlike update, it does nothing if such a record does not exist.
  • createOrUpdateBy — creates a new record or modifies an existing record identified by the value of a specified field.
  • delete — deletes a record with the given unique identifier.
    • deleteAll — bulk deletes records with the given unique identifier.

Other Methods

  • isMyRecord — helps determine whether the provided record belongs to this table.

Properties

  • type — a string "type" of the table. It differs from the table name and serves as the table identifier in the account space.

  • schema — a JSON schema corresponding to the structure of the table and used for its validation. It has several additional non-standard properties, helping analyze the meta-information of the table.