mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-23 20:53:34 +00:00
refactor(core): defer database global lookup (#41755)
This commit is contained in:
parent
5d32845b02
commit
5cc7811ec2
1 changed files with 1 additions and 1 deletions
|
|
@ -42,10 +42,10 @@ const databaseLayer = Layer.effect(
|
|||
export function layer(options: Options = { path: ":memory:" }) {
|
||||
return Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const global = yield* Global.Service
|
||||
const provide = (filename: string) => databaseLayer.pipe(Layer.provide(sqliteLayer({ filename })))
|
||||
const filename = options.path ?? ":memory:"
|
||||
if (filename === ":memory:" || isAbsolute(filename)) return provide(filename)
|
||||
const global = yield* Global.Service
|
||||
return provide(join(global.data, filename))
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue