Interface: LixStorageAdapter

Methods

close()

close(): Promise<void>

Closes the database and cleans up resources.

Returns

Promise<void>


connect()?

optional connect(args: { lix: Lix; }): void

Called after the Lix instance is fully initialized. Allows storage adapters to set up observers, hooks, etc.

Parameters

ParameterTypeDescription
args{ lix: Lix; }Object containing the Lix instance and future options
args.lixLix-

Returns

void


export()

export(): Promise<Blob>

Exports the current storage state as a blob.

Returns

Promise<Blob>


getPersistedState()?

optional getPersistedState(): Promise<undefined | { activeAccounts?: Pick<{ id: LixGenerated<string>; name: string; }, "id" | "name">[]; }>

Returns any persisted state that should be restored. Called during Lix initialization to restore saved state.

Returns

Promise<undefined | { activeAccounts?: Pick<{ id: LixGenerated<string>; name: string; }, "id" | "name">[]; }>

Promise resolving to persisted state, or undefined if none


open()

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

Opens and returns the database instance.

Parameters

ParameterTypeDescription
args{ blob?: Blob; createBlob: () => Promise<Blob>; }Arguments for opening the storage
args.blob?BlobOptional blob to initialize the storage with (takes precedence over existing data)
args.createBlob() => Promise<Blob>Callback to create a new blob if no existing data is found

Returns

Promise<SqliteWasmDatabase>