Skip to main content Link Search Menu Expand Document (external link)

PgClient.ts overview

Since v1.0.0


Exports Grouped by Category


constructor

makeCompiler

Signature

declare const makeCompiler: (transform?: (_: string) => string, transformJson?: boolean) => Statement.Compiler

Source

Since v1.0.0

constructors

PgClientConfig (interface)

Signature

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 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<string, unknown> | undefined

  readonly transformResultNames?: ((str: string) => string) | undefined
  readonly transformQueryNames?: ((str: string) => string) | undefined
  readonly transformJson?: boolean | undefined
  readonly types?: Pg.CustomTypesConfig | undefined
}

Source

Since v1.0.0

make

Signature

declare const make: (options: PgClientConfig) => Effect.Effect<PgClient, SqlError, Scope.Scope | Reactivity.Reactivity>

Source

Since v1.0.0

custom types

PgCustom (type alias)

Signature

type PgCustom = PgJson

Source

Since v1.0.0

layers

layer

Signature

declare const layer: (config: PgClientConfig) => Layer.Layer<PgClient | Client.SqlClient, SqlError>

Source

Since v1.0.0

layerConfig

Signature

declare const layerConfig: (
  config: Config.Config.Wrap<PgClientConfig>
) => Layer.Layer<PgClient | Client.SqlClient, ConfigError.ConfigError | SqlError>

Source

Since v1.0.0

models

PgClient (interface)

Signature

export interface PgClient extends Client.SqlClient {
  readonly [TypeId]: TypeId
  readonly config: PgClientConfig
  readonly json: (_: unknown) => Fragment
  readonly listen: (channel: string) => Stream.Stream<string, SqlError>
  readonly notify: (channel: string, payload: string) => Effect.Effect<void, SqlError>
}

Source

Since v1.0.0

tags

PgClient

Signature

declare const PgClient: Context.Tag<PgClient, PgClient>

Source

Since v1.0.0

type ids

TypeId

Signature

declare const TypeId: "~@effect/sql-pg/PgClient"

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = "~@effect/sql-pg/PgClient"

Source

Since v1.0.0