SqliteUnifiedStorage
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:21
SQLite-based unified storage with indexed query support. Uses native SQLite indexes for efficient queries on swap data.
Implements
Constructors
Constructor
new SqliteUnifiedStorage(filename): SqliteUnifiedStorage;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:34
Creates a new SqliteUnifiedStorage instance
Parameters
| Parameter | Type | Description |
|---|---|---|
filename | string | Path to the SQLite database file |
Returns
SqliteUnifiedStorage
Properties
db?
optional db: Database;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:26
SQLite database instance (available after init)
filename
readonly filename: string;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:24
Path to the SQLite database file
indexedColumns?
optional indexedColumns: string[];
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:28
List of indexed column names
Methods
init()
init(indexes, compositeIndexes): Promise<void>;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:39
Initializes the storage with given indexes and composite indexes
Parameters
| Parameter | Type | Description |
|---|---|---|
indexes | readonly [{ key: "id"; nullable: false; type: "string"; unique: true; }, { key: "escrowHash"; nullable: true; type: "string"; unique: true; }, { key: "type"; nullable: false; type: "number"; unique: false; }, { key: "initiator"; nullable: false; type: "string"; unique: false; }, { key: "state"; nullable: false; type: "number"; unique: false; }, { key: "paymentHash"; nullable: true; type: "string"; unique: false; }] | |
compositeIndexes | readonly [{ keys: readonly ["initiator", "id"]; unique: false; }, { keys: readonly ["type", "state"]; unique: false; }, { keys: readonly ["type", "paymentHash"]; unique: false; }, { keys: readonly ["type", "initiator", "state"]; unique: false; }] |
Returns
Promise<void>
Implementation of
query()
query(params): Promise<any[]>;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:74
Params are specified in the following way:
- [[condition1, condition2]] - returns all rows where condition1 AND condition2 is met
- [[condition1], [condition2]] - returns all rows where condition1 OR condition2 is met
- [[condition1, condition2], [condition3]] - returns all rows where (condition1 AND condition2) OR condition3 is met
Parameters
| Parameter | Type | Description |
|---|---|---|
params | QueryParams[][] |
Returns
Promise<any[]>
Implementation of
remove()
remove(value): Promise<void>;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:112
Removes an object from storage
Parameters
| Parameter | Type | Description |
|---|---|---|
value | any | Object to remove (must have an id property) |
Returns
Promise<void>
Implementation of
removeAll()
removeAll(values): Promise<void>;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:123
Removes multiple objects from storage in a batch operation
Parameters
| Parameter | Type | Description |
|---|---|---|
values | any[] | Array of objects to remove |
Returns
Promise<void>
Implementation of
save()
save(value): Promise<void>;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:130
Saves an object to storage, updating indexes as needed
Parameters
| Parameter | Type | Description |
|---|---|---|
value | any | Object to save (must have an id property) |
Returns
Promise<void>
Implementation of
saveAll()
saveAll(values): Promise<void>;
Defined in: atomiq-storage-sqlite/src/SqliteUnifiedStorage.ts:146
Saves multiple objects to storage in a batch operation
Parameters
| Parameter | Type | Description |
|---|---|---|
values | any[] | Array of objects to save |
Returns
Promise<void>