Class: InMemoryStorage

In-memory storage adapter for Lix.

Data is stored only for the lifetime of the JavaScript context. When the page is refreshed or the application is closed, all data is lost.

Implements

Constructors

Constructor

new InMemoryStorage(): InMemoryStorage

Returns

InMemoryStorage

Methods

close()

close(): Promise<void>

Closes the database connection.

Note: For in-memory databases, this just clears the reference. The data is lost when the database is no longer referenced.

Returns

Promise<void>

Implementation of

LixStorageAdapter.close


export()

export(): Promise<Blob>

Exports the current database state as a blob.

Returns

Promise<Blob>

Throws

Error if the database has not been opened yet

Implementation of

LixStorageAdapter.export


open()

open(args: { blob?: Blob; createBlob: () => Promise<Blob>; }): Promise<SqliteWasmDatabase>

Opens an in-memory SQLite database.

Creates a new database and optionally initializes it with the provided blob. Returns the same database instance on subsequent calls.

Parameters

ParameterType
args{ blob?: Blob; createBlob: () => Promise<Blob>; }
args.blob?Blob
args.createBlob() => Promise<Blob>

Returns

Promise<SqliteWasmDatabase>

Implementation of

LixStorageAdapter.open