mirror of
https://github.com/Effect-TS/effect.git
synced 2026-11-22 11:35:35 +08:00
34 lines
868 B
TypeScript
34 lines
868 B
TypeScript
/**
|
|
* @since 1.0.0
|
|
*/
|
|
import type * as Effect from "effect/Effect"
|
|
import * as Layer from "effect/Layer"
|
|
import * as Migrator from "effect/unstable/sql/Migrator"
|
|
import type * as Client from "effect/unstable/sql/SqlClient"
|
|
import type { SqlError } from "effect/unstable/sql/SqlError"
|
|
|
|
/**
|
|
* @since 1.0.0
|
|
*/
|
|
export * from "effect/unstable/sql/Migrator"
|
|
|
|
/**
|
|
* @category constructor
|
|
* @since 1.0.0
|
|
*/
|
|
export const run: <R2 = never>(
|
|
options: Migrator.MigratorOptions<R2>
|
|
) => Effect.Effect<
|
|
ReadonlyArray<readonly [id: number, name: string]>,
|
|
Migrator.MigrationError | SqlError,
|
|
Client.SqlClient | R2
|
|
> = Migrator.make({})
|
|
|
|
/**
|
|
* @category constructor
|
|
* @since 1.0.0
|
|
*/
|
|
export const layer = <R>(
|
|
options: Migrator.MigratorOptions<R>
|
|
): Layer.Layer<never, Migrator.MigrationError | SqlError, Client.SqlClient | R> => Layer.effectDiscard(run(options))
|