MCPcopy Create free account
hub / github.com/anomalyco/opencode / nativeLayer

Function nativeLayer

packages/core/src/database/sqlite.bun.ts:154–167  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

152 })
153
154const nativeLayer = (config: Config) =>
155 Layer.effect(
156 Sqlite.Native,
157 Effect.gen(function* () {
158 const native = new Database(config.filename, {
159 readonly: config.readonly,
160 readwrite: config.readwrite ?? true,
161 create: config.create ?? true,
162 })
163 yield* Effect.addFinalizer(() => Effect.sync(() => native.close()))
164 if (config.disableWAL !== true) native.run("PRAGMA journal_mode = WAL;")
165 return native
166 }),
167 )
168
169const sqliteLayer = (config: Config) => Layer.effect(Client.SqlClient, make(config))
170

Callers 1

layerFunction · 0.70

Calls 3

syncMethod · 0.80
closeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected