ReadonlykindIdentifier for logging/diagnostics (e.g., 'better-sqlite3', 'postgres').
ReadonlycapabilitiesCapability flags indicating supported features.
Opens the underlying connection or initializes the backing store.
Optionaloptions: SupabaseAdapterOptionsExecutes a mutation statement (INSERT, UPDATE, DELETE).
SQL statement to execute
Optionalparameters: StorageParametersOptional parameters for the statement
Metadata about affected rows
Retrieves a single row (or null if none found).
SQL SELECT statement
Optionalparameters: StorageParametersOptional parameters for the statement
First row or null if no results
Retrieves all rows returned by the statement.
WARNING: For large result sets, this loads everything into memory. Consider using streaming (if supported) for large queries.
SQL SELECT statement
Optionalparameters: StorageParametersOptional parameters for the statement
Array of all matching rows (empty array if none)
Executes a script containing multiple SQL statements.
Statements are typically delimited by semicolons. This is useful for running migrations or initialization scripts. No results are returned.
SQL script with multiple statements
Runs fn in a transaction on one pooled client: COMMIT when it resolves, ROLLBACK when it or COMMIT throws, and
that error is thrown. A COMMIT that PostgreSQL answers with ROLLBACK, as it answers one when a statement in the
transaction failed and fn went on, throws too, as nothing was written. When the ROLLBACK cannot run either, the
error thrown is still the transaction's own, with the ROLLBACK's on it as rollbackError, and the client goes back
to the pool closed, as it does when its connection failed, since it could still be inside the transaction.
Stream large result sets.
Optionalparameters: unknownOptionaloptions: StreamOptionsWrites the operations in one transaction, each under a savepoint: a failed statement aborts a PostgreSQL transaction, so a failed operation rolls back to its savepoint and the batch goes on, as the PostgreSQL adapter's batch does. The operations that succeeded commit, and the result names each one that failed by its index, one whose values could not be read (a getter or a proxy that throws) among them. An operation of a type the batch does not know writes nothing and is not counted.
Apply database migrations.
Get performance metrics.
Keeps the answers of SELECTs through get and all, at most maxSize of them, and answers the same statement with
the same parameters from them, each time with a copy, so a caller that changes the row or list it was given changes
nothing the cache answers next. An answer holding a value with no faithful copy, such as an interval, which pg
parses to an object of its own, is not kept. A SELECT is a statement whose first word, past white space and
comments (a -- comment ends at a line feed or a carriage return), is SELECT; a string of several statements
counts as a write. One the cache does not hold runs once, in a transaction of its own, and its answer is kept only
when PostgreSQL gave that transaction no ID, which it gives a transaction when it first writes to the database: a
SELECT that calls a function that writes, or makes a table with INTO, runs each time it is asked. That check reads
pg_current_xact_id_if_assigned(), so the cache needs PostgreSQL 13 or later. A SELECT the cache may keep is sent
its values as pg's own prepareValue writes them when the call is made, so its answer is the answer to those values
whatever the caller changes afterwards, and two calls share an answer only when they send the same statement and the
same values; with pg before 8.15.0, which does not export prepareValue, a SELECT with parameters runs each time it
is asked. Every statement that writes, through run, exec, get or all, and every transaction, batchWrite and
migrate, clears the cache when it ends, and a read that was in flight across one keeps nothing, so the cache never
answers a row as it stood before this adapter's own write. It cannot see a write through another adapter, pool or
process, an effect that writes no row, such as pg_notify() or an advisory lock, nor a SELECT whose answer changes
from one call to the next by itself, such as one that calls random(), now() or nextval(): a kept answer is
given again without running the statement, until clearCache(). Run a statement wanted for its effect through
run, or begin it with a word other than SELECT, such as VALUES (nextval('ids')), which runs each time.
Deprecated
Use
createPostgresAdapterfrom@framers/sql-storage-adapter/postgreswith the Supabase connection string.