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

PgQuery overview

Querying

Added in v1.0.0


Table of contents


models

QueryStreamOptions (interface)

Signature

export interface QueryStreamOptions {
  maxRowsPerRead: number
}

Added in v1.0.0

querying

all

Signature

export declare const all: {
  <R, _, A = unknown>(
    sql: string,
    schema: Schema.Schema<A, _, R>
  ): (
    ...values: Array<unknown>
  ) => Effect.Effect<A[], PgError.PostgresQueryError | PgError.PostgresValidationError, R | pg.ClientBase>
  (sql: string): (...values: Array<unknown>) => Effect.Effect<Array<unknown>, PgError.PostgresQueryError, pg.ClientBase>
}

Added in v1.0.0

one

Signature

export declare const one: {
  (
    sql: string
  ): (
    ...values: Array<unknown>
  ) => Effect.Effect<unknown, PgError.PostgresQueryError | PgError.PostgresUnexpectedNumberOfRowsError, pg.ClientBase>
  <R, _, A = unknown>(
    sql: string,
    schema?: Schema.Schema<A, _, R> | undefined
  ): (
    ...values: Array<unknown>
  ) => Effect.Effect<
    A,
    PgError.PostgresQueryError | PgError.PostgresValidationError | PgError.PostgresUnexpectedNumberOfRowsError,
    pg.ClientBase | R
  >
}

Added in v1.0.0

stream

Signature

export declare const stream: {
  <R, _, A>(
    queryText: string,
    schema: Schema.Schema<A, _, R>,
    options?: Partial<QueryStreamOptions>
  ): (
    ...values: Array<unknown>
  ) => Stream.Stream<A, PgError.PostgresQueryError | PgError.PostgresValidationError, pg.ClientBase | R>
  (
    queryText: string,
    options?: Partial<QueryStreamOptions>
  ): (...values: Array<unknown>) => Stream.Stream<unknown, PgError.PostgresQueryError, pg.ClientBase>
}

Added in v1.0.0

transactions

begin

Signature

export declare const begin: Effect.Effect<void, PgError.PostgresQueryError, pg.ClientBase>

Added in v1.0.0

commit

Signature

export declare const commit: Effect.Effect<void, PgError.PostgresQueryError, pg.ClientBase>

Added in v1.0.0

rollback

Signature

export declare const rollback: Effect.Effect<void, PgError.PostgresQueryError, pg.ClientBase>

Added in v1.0.0

transaction

Signature

export declare const transaction: <R, E, A>(
  self: Effect.Effect<A, E, R>
) => Effect.Effect<A, PgError.PostgresQueryError | E, pg.ClientBase | R>

Added in v1.0.0

transactionRollback

Signature

export declare const transactionRollback: <R, E, A>(
  self: Effect.Effect<A, E, R>
) => Effect.Effect<A, PgError.PostgresQueryError | E, pg.ClientBase | R>

Added in v1.0.0