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

Function nativeLayer

packages/core/src/database/sqlite.node.ts:147–162  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

145 })
146
147const nativeLayer = (config: Config) =>
148 Layer.effect(
149 Sqlite.Native,
150 Effect.gen(function* () {
151 const native = new DatabaseSync(config.filename, {
152 readOnly: config.readonly,
153 timeout: config.timeout,
154 allowExtension: config.allowExtension,
155 enableForeignKeyConstraints: true,
156 open: true,
157 })
158 yield* Effect.addFinalizer(() => Effect.sync(() => native.close()))
159 if (config.disableWAL !== true && config.readonly !== true) native.exec("PRAGMA journal_mode = WAL;")
160 return native
161 }),
162 )
163
164const sqliteLayer = (config: Config) => Layer.effect(Client.SqlClient, make(config))
165

Callers 1

layerFunction · 0.70

Calls 2

syncMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected