SqlClient overview
Added in v1.0.0
Table of contents
constructors
make
Signature
export declare const make: ({
acquirer,
beginTransaction,
commit,
rollback,
rollbackSavepoint,
savepoint,
transactionAcquirer
}: SqlClient.MakeOptions) => SqlClient
Added in v1.0.0
models
SqlClient
Signature
export declare const SqlClient: Tag<SqlClient, SqlClient>
Added in v1.0.0
SqlClient (interface)
Signature
export interface SqlClient 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
SqlClient (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
transactions
makeWithTransaction
Signature
export declare const makeWithTransaction: <I, S>(options: {
readonly transactionTag: Tag<I, readonly [conn: S, counter: number]>
readonly spanAttributes: ReadonlyArray<readonly [string, unknown]>
readonly acquireConnection: Effect<readonly [CloseableScope | undefined, S], SqlError>
readonly begin: (conn: NoInfer<S>) => Effect<void, SqlError>
readonly savepoint: (conn: NoInfer<S>, id: number) => 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>
}) => <R, E, A>(effect: Effect<A, E, R>) => Effect<A, E | SqlError, R>
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