Skip to content

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.

all(sql): Promise<Record<string, unknown>[]>

Defined in: server/src/adapters/executor.ts:14

Execute a query and return the rows.

CompiledSql

Promise<Record<string, unknown>[]>


exec(sql): Promise<void>

Defined in: server/src/adapters/executor.ts:16

Execute a write (INSERT / UPDATE / DELETE / DDL). Returns nothing.

CompiledSql

Promise<void>


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.

T

(tx) => Promise<T>

Promise<T>