Skip to content

Interface: SqlExecutor

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

A minimal contract every SQL driver (better-sqlite3, D1) 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 is 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>


execWithMeta(sql): Promise<{ meta: { changes: number; last_row_id?: number; duration?: number; }; }>

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

Execute a write and return driver metadata for non-CAS observability.

CompiledSql

Promise<{ meta: { changes: number; last_row_id?: number; duration?: number; }; }>


execReturningRows<Row>(sql): Promise<Row[]>

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

Execute one statement that returns rows (e.g. UPDATE ... RETURNING).

Row = Record<string, unknown>

CompiledSql

Promise<Row[]>


transaction<T>(fn): Promise<T>

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

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>