Skip to content

SqlClient

10 exports Added in v1.0.0 Source

Constructors

make

Added in v1.0.0 Source

Signature

declare const make: (options: SqlClient.MakeOptions) => Effect<SqlClient, never, Reactivity>;

Models

SqlClient

Added in v1.0.0 Source

Signature

declare const SqlClient: Tag<SqlClient, SqlClient>;

SqlClient

Added in v1.0.0 Source

SqlClient interface

Added in v1.0.0 Source

Signature

interface SqlClient extends Constructor {
  <A extends object = Row>(strings: TemplateStringsArray, ...args: Array<any>): Statement<A>;
  (value: string): Identifier;
  readonly [TypeId]: typeof TypeId;
  readonly reactive: <A, E, R>(keys: readonly Array<unknown> | ReadonlyRecord<string, readonly Array<unknown>>, effect: Effect<A, E, R>) => Stream<A, E, R>;
  readonly reactiveMailbox: <A, E, R>(keys: readonly Array<unknown> | ReadonlyRecord<string, readonly Array<unknown>>, effect: Effect<A, E, R>) => Effect<ReadonlyMailbox<A, E>, never, Scope | R>;
  readonly reserve: Effect<Connection, SqlError, Scope>;
  readonly safe: SqlClient;
  readonly withoutTransforms: () => this;
  readonly withTransaction: <R, E, A>(self: Effect<A, E, R>) => Effect<A, SqlError | E, R>;
}

Other

SafeIntegers

Added in v1.0.0 Source

Signature

declare class SafeIntegers extends any {
  constructor();
}

Signature

declare const TransactionConnection: Tag<TransactionConnection, readonly [Connection, number]>;

TransactionConnection interface

Added in v1.0.0 Source

Signature

interface TransactionConnection {
  readonly _: typeof _;
}

Transactions

Signature

declare const makeWithTransaction: <I, S>(options: {
  readonly acquireConnection: Effect<readonly [CloseableScope | undefined, S], SqlError>;
  readonly begin: (conn: NoInfer<S>) => Effect<void, SqlError>;
  readonly commit: (conn: NoInfer<S>) => Effect<void, SqlError>;
  readonly rollback: (conn: NoInfer<S>) => Effect<void, SqlError>;
  readonly rollbackSavepoint: (conn: NoInfer<S>, id: number) => Effect<void, SqlError>;
  readonly savepoint: (conn: NoInfer<S>, id: number) => Effect<void, SqlError>;
  readonly spanAttributes: ReadonlyArray<readonly [string, unknown]>;
  readonly transactionTag: Tag<I, readonly [conn: S, counter: number]>;
}) => <R, E, A>(effect: Effect<A, E, R>) => Effect<A, E | SqlError, R>;

Type Ids

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol;

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId;