Skip to main content

Database SDK

The Database SDK provides a data storage service that can be used directly. Through this document, you will understand how to use the Database SDK to operate on the defined Database Elements.

Usage

If you want to use the Database SDK in a Babel application, you first need to import the corresponding Database Element in the Element:

import { myDatabaseElement } from "#elements";

APIs

  • get: Fetches a record from the database using the specified key.
  • list: Retrieves all records in the database.
  • keys: Retrieves all keys of the records in the database.
  • set: Sets a record in the database. If the key already exists, it will overwrite the existing record.
  • count: Gets the number of records in the database.
  • delete: Deletes a record from the database using the specified key.
  • deleteAll: Deletes all records from the database.
  • query: Queries the database for records based on specified fields and values.
  • getAsAny: Retrieve the record of the specified key, the returned object type is not constrained by the data table type.