/** * @since 1.0.0 */ import * as Reactivity from "@effect/experimental/Reactivity"; import * as Client from "@effect/sql/SqlClient"; import { SqlError } from "@effect/sql/SqlError"; import type { Custom, Fragment } from "@effect/sql/Statement"; import * as Statement from "@effect/sql/Statement"; import * as Config from "effect/Config"; import type * as ConfigError from "effect/ConfigError"; import * as Context from "effect/Context"; import * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import * as Redacted from "effect/Redacted"; import * as Scope from "effect/Scope"; import * as Stream from "effect/Stream"; import type { Duplex } from "node:stream"; import type { ConnectionOptions } from "node:tls"; import * as Pg from "pg"; /** * @category type ids * @since 1.0.0 */ export declare const TypeId: TypeId; /** * @category type ids * @since 1.0.0 */ export type TypeId = "~@effect/sql-pg/PgClient"; /** * @category models * @since 1.0.0 */ export interface PgClient extends Client.SqlClient { readonly [TypeId]: TypeId; readonly config: PgClientConfig; readonly json: (_: unknown) => Fragment; readonly listen: (channel: string) => Stream.Stream; readonly notify: (channel: string, payload: string) => Effect.Effect; } /** * @category tags * @since 1.0.0 */ export declare const PgClient: Context.Tag; /** * @category constructors * @since 1.0.0 */ export interface PgClientConfig { readonly url?: Redacted.Redacted | undefined; readonly host?: string | undefined; readonly port?: number | undefined; readonly path?: string | undefined; readonly ssl?: boolean | ConnectionOptions | undefined; readonly database?: string | undefined; readonly username?: string | undefined; readonly password?: Redacted.Redacted | undefined; readonly stream?: (() => Duplex) | undefined; readonly idleTimeout?: Duration.DurationInput | undefined; readonly connectTimeout?: Duration.DurationInput | undefined; readonly maxConnections?: number | undefined; readonly minConnections?: number | undefined; readonly connectionTTL?: Duration.DurationInput | undefined; readonly applicationName?: string | undefined; readonly spanAttributes?: Record | undefined; readonly transformResultNames?: ((str: string) => string) | undefined; readonly transformQueryNames?: ((str: string) => string) | undefined; readonly transformJson?: boolean | undefined; readonly types?: Pg.CustomTypesConfig | undefined; } /** * @category constructors * @since 1.0.0 */ export declare const make: (options: PgClientConfig) => Effect.Effect; /** * @category constructors * @since 1.0.0 */ export interface PgClientFromPoolOptions { readonly acquire: Effect.Effect; readonly applicationName?: string | undefined; readonly spanAttributes?: Record | undefined; readonly transformResultNames?: ((str: string) => string) | undefined; readonly transformQueryNames?: ((str: string) => string) | undefined; readonly transformJson?: boolean | undefined; readonly types?: Pg.CustomTypesConfig | undefined; } /** * Create a `PgClient` from an existing `pg` pool. * * You control the pool lifecycle via `acquire` (typically `Effect.acquireRelease`). * * @category constructors * @since 1.0.0 */ export declare const fromPool: (options: PgClientFromPoolOptions) => Effect.Effect; /** * @category layers * @since 1.0.0 */ export declare const layerConfig: (config: Config.Config.Wrap) => Layer.Layer; /** * @category layers * @since 1.0.0 */ export declare const layer: (config: PgClientConfig) => Layer.Layer; /** * @category layers * @since 1.0.0 */ export declare const layerFromPool: (options: PgClientFromPoolOptions) => Layer.Layer; /** * @category constructor * @since 1.0.0 */ export declare const makeCompiler: (transform?: (_: string) => string, transformJson?: boolean) => Statement.Compiler; /** * @category custom types * @since 1.0.0 */ export type PgCustom = PgJson; /** * @category custom types * @since 1.0.0 */ interface PgJson extends Custom<"PgJson", unknown> { } /** * @category custom types * @since 1.0.0 */ declare const PgJson: (i0: unknown, i1: void, i2: void) => Fragment; export {}; //# sourceMappingURL=PgClient.d.ts.map