MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromRecord

Function fromRecord

packages/effect/src/unstable/sql/Migrator.ts:384–397  ·  view source on GitHub ↗
(migrations: Record<string, Effect.Effect<void, unknown, Client.SqlClient>>)

Source from the content-addressed store, hash-verified

382 * @since 4.0.0
383 */
384export const fromRecord = (migrations: Record<string, Effect.Effect<void, unknown, Client.SqlClient>>): Loader =>
385 pipe(
386 Object.keys(migrations),
387 Arr.flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)),
388 Arr.map(
389 ([key, id, name]): ResolvedMigration => [
390 Number(id),
391 name,
392 Effect.succeed(migrations[key])
393 ]
394 ),
395 Arr.sort(migrationOrder),
396 Effect.succeed
397 )
398
399/**
400 * Creates a migration loader that reads a directory with `FileSystem`, imports

Callers

nothing calls this directly

Calls 4

pipeFunction · 0.90
NumberInterface · 0.50
mapMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected