| 1 | import * as Effect from "effect/Effect"; |
| 2 | import type { SQLiteErrorType } from "./SQLiteError.ts"; |
| 3 | |
| 4 | /** |
| 5 | * A prepared SQL statement that can be executed multiple times. |
| 6 | */ |
| 7 | export interface SQLiteStatement<R = unknown> { |
| 8 | /** |
| 9 | * Execute the statement and return all matching rows. |
| 10 | */ |
| 11 | all<T = R>(...params: unknown[]): Effect.Effect<T[], SQLiteErrorType>; |
| 12 | |
| 13 | /** |
| 14 | * Execute the statement and return the first matching row. |
| 15 | */ |
| 16 | get<T = R>( |
| 17 | ...params: unknown[] |
| 18 | ): Effect.Effect<T | undefined, SQLiteErrorType>; |
| 19 | |
| 20 | /** |
| 21 | * Execute the statement for its side effects (INSERT, UPDATE, DELETE). |
| 22 | */ |
| 23 | run(...params: unknown[]): Effect.Effect<void, SQLiteErrorType>; |
| 24 | } |