SqlConnection
Low-level SQL connection contract used by driver integrations.
A Connection is the driver-facing layer under SqlClient. It executes
already-compiled SQL with positional parameters and can return transformed
rows, raw driver results, streams, value arrays, or unprepared statement
results. This module also defines the scoped connection acquirer type, the
connection service tag, and the generic row shape.
Models
Scoped effect that acquires a Connection, may fail with SqlError, and
requires a Scope for release.
Signature
type Acquirer = Effect<Connection, SqlError, Scope>Connection interface
Low-level SQL driver connection capable of executing compiled SQL as transformed rows, raw results, streams, value arrays, or unprepared statements.
Signature
interface Connection { readonly execute: (sql: string, params: readonly Array<unknown>, transformRows: <A extends object>(row: readonly Array<A>) => readonly Array<A> | undefined) => Effect<readonly Array<any>, SqlError>; readonly executeRaw: (sql: string, params: readonly Array<unknown>) => Effect<unknown, SqlError>; readonly executeStream: (sql: string, params: readonly Array<unknown>, transformRows: <A extends object>(row: readonly Array<A>) => readonly Array<A> | undefined) => Stream<any, SqlError>; readonly executeUnprepared: (sql: string, params: readonly Array<unknown>, transformRows: <A extends object>(row: readonly Array<A>) => readonly Array<A> | undefined) => Effect<readonly Array<any>, SqlError>; readonly executeValues: (sql: string, params: readonly Array<unknown>) => Effect<readonly Array<readonly Array<unknown>>, SqlError>; readonly executeValuesUnprepared: (sql: string, params: readonly Array<unknown>) => Effect<readonly Array<readonly Array<unknown>>, SqlError>;}Generic SQL row shape mapping column names to unknown values.
Signature
type Row = { [column: string]: unknown;}Services
Connection
Service tag for a low-level SQL Connection.
Signature
declare const Connection: Service<Connection, Connection>