IStorage interface
The base storage interface for the storage plugin to be used.
Signature:
export interface IStorage
Methods
.fetch ()
Fetch a value from storage.
Signature:
fetch<T>(key: string, id: string): Promise<T> | T | undefined;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | A key to help distinguish the collection where the element is stored. |
id | String | The id of the element to fetch. |
Return type: Promise < T > | T | Undefined
.remove ()
Delete a value from storage.
Signature:
remove(key: string, id: string): void | Promise<any>;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | A key to help distinguish the collection where the element is stored. |
id | String | The id of the element to delete. |
Return type: void | Promise < any >
.save ()
Save a value in storage.
Signature:
save<T>(value: T, key: string, id: string): void | Promise<any>;
Parameters:
Parameter | Type | Description |
---|---|---|
value | T | The value to set. |
key | String | A key to help distinguish the collection where the element is stored. |
id | String | The id of the element to save. |
Return type: void | Promise < any >
.search ()
Search for a value in storage.
Signature:
search<T>(key: string, query: { [key: string]: any; }): Promise<T[]> | T[];
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | A key to help distinguish the collection where the element is stored. |
query | { key: string: any; } | The query with the parameters to search for. |
Return type: Promise < T > | T