effect-sql-kysely
Version:
A full-featured integration between `@effect/sql` and `Kysely` that provides type-safe database operations with Effect's powerful error handling and resource management.
21 lines (20 loc) • 1.03 kB
TypeScript
import { Reactivity } from "@effect/experimental";
import { SqlClient } from "@effect/sql";
import type { Effect } from "effect";
import type * as Layer from "effect/Layer";
import type * as Scope from "effect/Scope";
import type * as kysely from "kysely";
import * as Database from "./Database.js";
export declare const make: <DB, Self>(id: string) => MsSqlDatabaseConstructor<DB, Self>;
export interface MsSqlDatabaseConstructor<DB, Self> extends Database.CoreDatabaseConstructor<DB, Self> {
readonly layer: <E, R>(options: {
readonly acquire: Effect.Effect<kysely.Kysely<DB>, E, R | Scope.Scope>;
readonly spanAttributes?: ReadonlyArray<readonly [string, string]>;
readonly chunkSize?: number;
}) => Layer.Layer<Self, E, Exclude<R, Scope.Scope>>;
}
export declare const makeSqlClient: <DB>(options: {
database: kysely.Kysely<DB>;
spanAttributes?: ReadonlyArray<readonly [string, string]>;
chunkSize?: number;
}) => Effect.Effect<SqlClient.SqlClient, never, Reactivity.Reactivity>;