PgClient
Constructor
makeCompiler
Added in v1.0.0
Source
Signature
declare function makeCompiler(transform?: (_: string) => string, transformJson: boolean): Compiler;Constructors
Signature
declare const fromPool: (
...args: [options: PgClientFromPoolOptions]
) => Effect<PgClient, SqlError, any>;Signature
declare function make(options: PgClientConfig): Effect<PgClient, SqlError, any>;PgClientConfig interface
Added in v1.0.0
Source
Signature
interface PgClientConfig {
readonly applicationName?: string;
readonly connectionTTL?: any;
readonly connectTimeout?: any;
readonly database?: string;
readonly host?: string;
readonly idleTimeout?: any;
readonly maxConnections?: number;
readonly minConnections?: number;
readonly password?: Redacted<string>;
readonly path?: string;
readonly port?: number;
readonly spanAttributes?: Record<string, unknown>;
readonly ssl?: any;
readonly stream?: () => Duplex;
readonly transformJson?: boolean;
readonly transformQueryNames?: (str: string) => string;
readonly transformResultNames?: (str: string) => string;
readonly types?: any;
readonly url?: Redacted<string>;
readonly username?: string;
}PgClientFromPoolOptions interface
Added in v1.0.0
Source
Signature
interface PgClientFromPoolOptions {
readonly acquire: Effect<Pool, SqlError, Scope>;
readonly applicationName?: string;
readonly spanAttributes?: Record<string, unknown>;
readonly transformJson?: boolean;
readonly transformQueryNames?: (str: string) => string;
readonly transformResultNames?: (str: string) => string;
readonly types?: any;
}Custom Types
Layers
Signature
declare function layer(config: PgClientConfig): Layer<any, SqlError>;layerConfig
Added in v1.0.0
Source
Signature
declare function layerConfig(config: Wrap<PgClientConfig>): Layer<any, any>;layerFromPool
Added in v1.0.0
Source
Signature
declare function layerFromPool(options: PgClientFromPoolOptions): Layer<any, SqlError>;Models
Signature
interface PgClient extends unknown {
readonly "~@effect/sql-pg/PgClient": "~@effect/sql-pg/PgClient";
readonly config: PgClientConfig;
readonly json: (_: unknown) => Fragment;
readonly listen: (channel: string) => Stream<string, SqlError>;
readonly notify: (channel: string, payload: string) => Effect<void, SqlError>;
}
Create a
PgClientfrom an existingpgpool.You control the pool lifecycle via
acquire(typicallyEffect.acquireRelease).