import { Effect } from "effect"; import { type OperationError } from "../errors/index.js"; import { Sqlite } from "./sqlite.js"; export interface ColumnDef { type: "TEXT" | "INTEGER" | "REAL" | "BLOB"; primaryKey?: boolean; notNull?: boolean; } export interface IndexDef { columns: (keyof T)[]; unique?: boolean; } export interface TableOptions { name: string; columns: Record; indexes?: IndexDef[]; } /** * A typed real SQL table (columns, indexes) on the shared `Sqlite` connection. * `Table.make` creates the schema idempotently; every operation afterwards is * an `Effect` bound to that connection. */ export declare class Table { private readonly db; private readonly options; private readonly columnNames; private readonly primaryKeys; private constructor(); /** Ensures the table and its indexes exist, then resolves the typed handle. */ static make(options: TableOptions): Effect.Effect, OperationError, Sqlite>; get name(): string; private createTable; private createIndexes; /** INSERT OR IGNORE. Resolves true if a row was inserted. */ insert(row: T): Effect.Effect; /** INSERT OR REPLACE. */ upsert(row: T): Effect.Effect; /** `SELECT * ... WHERE ` with positional params. */ query(where: string, params?: unknown[]): Effect.Effect; all(): Effect.Effect; /** Deletes every row. */ clear(): Effect.Effect; }