Client
Client
s are wrappers around a connection to a shared database that can be configured to point towards a particular branch and user combination.
new
(constructor)#
Construct a new Client
with a Configuration
. Clients have a built-in branch configured at compile-time (see Branching), but this value can be overwritten through the Configuration
. The default ROLE
(anonymous
) can be overwritten with a valid key from the User Dashboard.
query
#
query
is the async
interface for interacting with a database. All queries return an Array of rows (empty if nothing is returned from the query itself), with each row represented as an Object built from returned column names. See the Quick Start for more examples of running both simple and parameterized queries.
info
Typed queries without the use of any
are on the Roadmap.
queryStream
#
Like query
, but returning a stream of rows as they arrive from the server. This method is strongly preferred for large queries.
The RowStream
returned by queryStream()
is a standard Node stream that emits data
, error
, and end
events. RowStream
use object
mode, returning Record<string, any>
for each row as it arrives.
transaction
#
Creates a new Transaction
getBranch
#
Each client is compiled for a specific branch. To query that branch at runtime, use getBranch()
.