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.
new InMemoryStorage():
InMemoryStorage
InMemoryStorage
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.
Promise
<void
>
export():
Promise
<Blob
>
Exports the current database state as a blob.
Promise
<Blob
>
Error if the database has not been opened yet
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.
Parameter | Type |
---|---|
args | { blob? : Blob ; createBlob : () => Promise <Blob >; } |
args.blob? | Blob |
args.createBlob | () => Promise <Blob > |
Promise
<SqliteWasmDatabase
>