/** * @since 4.0.0 */ import * as Context from "../../Context.ts" import type { Effect } from "../../Effect.ts" import type { Scope } from "../../Scope.ts" import type { Stream } from "../../Stream.ts" import type { SqlError } from "./SqlError.ts" /** * @category model * @since 4.0.0 */ export interface Connection { readonly execute: ( sql: string, params: ReadonlyArray, transformRows: ((row: ReadonlyArray) => ReadonlyArray) | undefined ) => Effect, SqlError> /** * Execute the specified SQL query and return the raw results directly from * underlying SQL client. */ readonly executeRaw: ( sql: string, params: ReadonlyArray ) => Effect readonly executeStream: ( sql: string, params: ReadonlyArray, transformRows: ((row: ReadonlyArray) => ReadonlyArray) | undefined ) => Stream readonly executeValues: ( sql: string, params: ReadonlyArray ) => Effect>, SqlError> readonly executeUnprepared: ( sql: string, params: ReadonlyArray, transformRows: ((row: ReadonlyArray) => ReadonlyArray) | undefined ) => Effect, SqlError> } /** * @category model * @since 4.0.0 */ export type Acquirer = Effect /** * @category tag * @since 4.0.0 */ export const Connection = Context.Service("effect/sql/SqlConnection") /** * @category model * @since 4.0.0 */ export type Row = { readonly [column: string]: unknown }