MCPcopy Create free account
hub / github.com/effect-app/libs / ensureTable

Function ensureTable

packages/infra/src/Store/SQL.ts:428–442  ·  view source on GitHub ↗
(ns: string)

Source from the content-addressed store, hash-verified

426 if (namespace !== "primary" && !config.allowNamespace!(namespace)) {
427 throw new Error(`Namespace ${namespace} not allowed!`)
428 }
429 return namespace
430 }))
431
432 const toRow = (e: PM) => {
433 const newE = makeETag(e)
434 const id = newE[idKey] as string
435 const { _etag, [idKey]: _id, ...rest } = newE as any
436 const data = JSON.stringify(rest)
437 return { id, _etag: newE._etag!, data, item: newE }
438 }
439
440 const exec = (ns: string, query: string, params?: readonly unknown[]) =>
441 withNsSql(ns, (sql) => sql.unsafe(query, params as any).pipe(Effect.mapError(toDatabaseError)))
442
443 const ensureTable = (ns: string) =>
444 withNsSql(ns, (sql) =>
445 sql

Callers 1

makeSQLiteStorePerNsFunction · 0.85

Calls 2

withNsSqlFunction · 0.85
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…