TinyBase logoTinyBase

DatabaseExecuteCommand

The DatabaseExecuteCommand type describes a function that is used to execute commands against a database.

(
  sql: string,
  params?: any[],
): Promise<{[field: string]: any}[]>
TypeDescription
sqlstring

The SQL string to execute, which may include positional parameter placeholders.

params?any[]

An array of parameters to pass to the SQL command.

returnsPromise<{[field: string]: any}[]>

An promise of an array of objects, where each object represents a database result row (if the command was a query).

This is only used when developing custom database-oriented Persisters, and most TinyBase users will not need to be particularly aware of it.

It is modelled around the common pattern of database SDKs being able to execute commands with parameters, and have those (probably asynchronous) command executions return an array of objects, where each object represents a row.

Since

v5.2.0