/** * @since 1.0.0 */ import * as Context from "effect/Context" import type { Effect } from "effect/Effect" import type { Scope } from "effect/Scope" import type { Stream } from "effect/Stream" import type { SqlError } from "./SqlError.js" /** * @category model * @since 1.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> } /** * @since 1.0.0 */ export namespace Connection { /** * @category model * @since 1.0.0 */ export type Acquirer = Effect } /** * @category tag * @since 1.0.0 */ export const Connection = Context.GenericTag("@services/Connection") /** * @category model * @since 1.0.0 */ export type Row = { readonly [column: string]: unknown }