/** * @since 1.0.0 */ import type { Reactivity } from "@effect/experimental/Reactivity"; import type { Tag } from "effect/Context"; import * as Context from "effect/Context"; import type { Effect } from "effect/Effect"; import type { ReadonlyMailbox } from "effect/Mailbox"; import type { ReadonlyRecord } from "effect/Record"; import type { CloseableScope, Scope } from "effect/Scope"; import type { Stream } from "effect/Stream"; import type { NoInfer } from "effect/Types"; import type { Connection } from "./SqlConnection.js"; import type { SqlError } from "./SqlError.js"; import type { Compiler, Constructor } from "./Statement.js"; /** * @category type ids * @since 1.0.0 */ export declare const TypeId: unique symbol; /** * @category type ids * @since 1.0.0 */ export type TypeId = typeof TypeId; /** * @category models * @since 1.0.0 */ export interface SqlClient extends Constructor { readonly [TypeId]: TypeId; /** * Copy of the client for safeql etc. */ readonly safe: this; /** * Copy of the client without transformations. */ readonly withoutTransforms: () => this; readonly reserve: Effect; /** * With the given effect, ensure all sql queries are run in a transaction. */ readonly withTransaction: (self: Effect) => Effect; /** * Use the Reactivity service from @effect/experimental to create a reactive * query. */ readonly reactive: (keys: ReadonlyArray | ReadonlyRecord>, effect: Effect) => Stream; /** * Use the Reactivity service from @effect/experimental to create a reactive * query. */ readonly reactiveMailbox: (keys: ReadonlyArray | ReadonlyRecord>, effect: Effect) => Effect, never, R | Scope>; } /** * @category models * @since 1.0.0 */ export declare const SqlClient: Tag; /** * @category models * @since 1.0.0 */ export declare namespace SqlClient { /** * @category models * @since 1.0.0 */ interface MakeOptions { readonly acquirer: Connection.Acquirer; readonly compiler: Compiler; readonly transactionAcquirer?: Connection.Acquirer; readonly spanAttributes: ReadonlyArray; readonly beginTransaction?: string | undefined; readonly rollback?: string | undefined; readonly commit?: string | undefined; readonly savepoint?: ((name: string) => string) | undefined; readonly rollbackSavepoint?: ((name: string) => string) | undefined; readonly transformRows?: ((row: ReadonlyArray) => ReadonlyArray) | undefined; readonly reactiveMailbox?: (keys: ReadonlyArray | ReadonlyRecord>, effect: Effect) => Effect, never, R | Scope>; } } /** * @category constructors * @since 1.0.0 */ export declare const make: (options: SqlClient.MakeOptions) => Effect; /** * @since 1.0.0 * @category transactions */ export declare const makeWithTransaction: (options: { readonly transactionTag: Tag; readonly spanAttributes: ReadonlyArray; readonly acquireConnection: Effect; readonly begin: (conn: NoInfer) => Effect; readonly savepoint: (conn: NoInfer, id: number) => Effect; readonly commit: (conn: NoInfer) => Effect; readonly rollback: (conn: NoInfer) => Effect; readonly rollbackSavepoint: (conn: NoInfer, id: number) => Effect; }) => (effect: Effect) => Effect; /** * @since 1.0.0 */ export interface TransactionConnection { readonly _: unique symbol; } /** * @since 1.0.0 */ export declare const TransactionConnection: Tag; declare const SafeIntegers_base: Context.ReferenceClass; /** * @since 1.0.0 */ export declare class SafeIntegers extends SafeIntegers_base { } export {}; //# sourceMappingURL=SqlClient.d.ts.map