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

Client overview

Added in v1.0.0


Table of contents


constructor

layer

Signature

export declare const layer: (config: Config.Config.Wrap<PgClientConfig>) => Layer.Layer<any, ConfigError>

Added in v1.0.0

makeCompiler

Signature

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

Added in v1.0.0

constructors

PgClientConfig (interface)

Signature

export interface PgClientConfig {
  readonly url?: Secret.Secret | undefined

  readonly host?: string | undefined
  readonly port?: number | undefined
  readonly path?: string | undefined
  readonly ssl?: boolean | undefined
  readonly database?: string | undefined
  readonly username?: string | undefined
  readonly password?: Secret.Secret | undefined

  readonly idleTimeout?: Duration.DurationInput | undefined
  readonly connectTimeout?: Duration.DurationInput | undefined

  readonly maxConnections?: number | undefined
  readonly connectionTTL?: Duration.DurationInput | undefined

  readonly transformResultNames?: ((str: string) => string) | undefined
  readonly transformQueryNames?: ((str: string) => string) | undefined
  readonly transformJson?: boolean | undefined
  readonly fetchTypes?: boolean | undefined
  readonly prepare?: boolean | undefined
  readonly types?: Record<string, postgres.PostgresType> | undefined

  readonly debug?: postgres.Options<{}>["debug"] | undefined
}

Added in v1.0.0

make

Signature

export declare const make: (options: PgClientConfig) => Effect.Effect<PgClient, never, Scope>

Added in v1.0.0

custom types

PgCustom (type alias)

Signature

export type PgCustom = PgJson | PgArray

Added in v1.0.0

models

PgClient (interface)

Signature

export interface PgClient extends Client.Client {
  readonly [TypeId]: TypeId
  readonly config: PgClientConfig
  readonly json: (_: unknown) => Fragment
  readonly array: (_: ReadonlyArray<Primitive>) => Fragment
}

Added in v1.0.0

tags

PgClient

Signature

export declare const PgClient: any

Added in v1.0.0

type ids

TypeId

Signature

export declare const TypeId: typeof TypeId

Added in v1.0.0

TypeId (type alias)

Signature

export type TypeId = typeof TypeId

Added in v1.0.0