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

Client overview

Added in v1.0.0


Table of contents


constructors

make

Signature

export declare const make: ({
  acquirer,
  beginTransaction,
  commit,
  rollback,
  rollbackSavepoint,
  savepoint,
  transactionAcquirer
}: Client.MakeOptions) => Client

Added in v1.0.0

models

Client

Signature

export declare const Client: Tag<Client, Client>

Added in v1.0.0

Client (interface)

Signature

export interface Client extends Constructor {
  readonly [TypeId]: TypeId

  /**
   * Copy of the client for safeql etc.
   */
  readonly safe: this

  readonly reserve: Effect<Connection, SqlError, Scope>

  /**
   * With the given effect, ensure all sql queries are run in a transaction.
   */
  readonly withTransaction: <R, E, A>(self: Effect<A, E, R>) => Effect<A, E | SqlError, R>
}

Added in v1.0.0

Client (namespace)

Added in v1.0.0

MakeOptions (interface)

Signature

export interface MakeOptions {
  readonly acquirer: Connection.Acquirer
  readonly compiler: Compiler
  readonly transactionAcquirer: Connection.Acquirer
  readonly spanAttributes: ReadonlyArray<readonly [string, unknown]>
  readonly beginTransaction?: string | undefined
  readonly rollback?: string | undefined
  readonly commit?: string | undefined
  readonly savepoint?: ((name: string) => string) | undefined
  readonly rollbackSavepoint?: ((name: string) => string) | undefined
}

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

utils

TransactionConnection

Signature

export declare const TransactionConnection: Tag<TransactionConnection, readonly [conn: Connection, depth: number]>

Added in v1.0.0

TransactionConnection (interface)

Signature

export interface TransactionConnection {
  readonly _: unique symbol
}

Added in v1.0.0