Class: InMemoryEnvironment

In-process, in-memory environment.

Runs on the calling thread; great for tests, CLI, or light usage. In browsers, heavy operations can block the UI – prefer the Worker environment for production use.

Implements

Constructors

Constructor

new InMemoryEnvironment(): InMemoryEnvironment

Returns

InMemoryEnvironment

Methods

call()

call(name: string, payload?: unknown, opts?: { signal?: AbortSignal; }): Promise<unknown>

Invoke an engine function inside the environment.

Environments MUST implement this and route the call to the engine that booted next to SQLite, regardless of whether the engine runs on the main thread or inside a Worker. The SQL driver uses the "lix_exec_sync" route to execute compiled statements.

Parameters

ParameterType
namestring
payload?unknown
opts?{ signal?: AbortSignal; }
opts.signal?AbortSignal

Returns

Promise<unknown>

Implementation of

LixEnvironment.call


close()

close(): Promise<void>

Returns

Promise<void>

Implementation of

LixEnvironment.close


create()

create(opts: { blob: ArrayBuffer; }): Promise<void>

Parameters

ParameterType
opts{ blob: ArrayBuffer; }
opts.blobArrayBuffer

Returns

Promise<void>

Implementation of

LixEnvironment.create


exists()

exists(): Promise<boolean>

Returns

Promise<boolean>

Implementation of

LixEnvironment.exists


export()

export(): Promise<ArrayBuffer>

Returns

Promise<ArrayBuffer>

Implementation of

LixEnvironment.export


open()

open(opts: { boot: { args: BootArgs; }; emit: (ev: EngineEvent) => void; }): Promise<{ engine?: LixEngine; }>

Parameters

ParameterType
opts{ boot: { args: BootArgs; }; emit: (ev: EngineEvent) => void; }
opts.boot{ args: BootArgs; }
opts.boot.argsBootArgs
opts.emit(ev: EngineEvent) => void

Returns

Promise<{ engine?: LixEngine; }>

Implementation of

LixEnvironment.open