Interface: SqlExecutor
Interface: SqlExecutor
Section titled “Interface: SqlExecutor”Defined in: server/src/adapters/executor.ts:12
A minimal contract every SQL driver (better-sqlite3, D1, postgres.js)
implements. The rest of @sh1n4ps/plasma-server builds on this so a swap between
drivers only touches this adapter layer.
All methods are async because D1 and Hyperdrive are inherently async; synchronous drivers (better-sqlite3) simply wrap their result in a resolved promise.
Methods
Section titled “Methods”all(
sql):Promise<Record<string,unknown>[]>
Defined in: server/src/adapters/executor.ts:14
Execute a query and return the rows.
Parameters
Section titled “Parameters”CompiledSql
Returns
Section titled “Returns”Promise<Record<string, unknown>[]>
exec()
Section titled “exec()”exec(
sql):Promise<void>
Defined in: server/src/adapters/executor.ts:16
Execute a write (INSERT / UPDATE / DELETE / DDL). Returns nothing.
Parameters
Section titled “Parameters”CompiledSql
Returns
Section titled “Returns”Promise<void>
transaction()
Section titled “transaction()”transaction<
T>(fn):Promise<T>
Defined in: server/src/adapters/executor.ts:22
Run fn inside a transaction. The passed executor is scoped to that
transaction — writes issued via it must succeed atomically with the
fn’s return, or roll back if it throws.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”(tx) => Promise<T>
Returns
Section titled “Returns”Promise<T>