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:

ParameterTypeDescription
keyStringA key to help distinguish the collection where the element is stored.
idStringThe 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:

ParameterTypeDescription
keyStringA key to help distinguish the collection where the element is stored.
idStringThe 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:

ParameterTypeDescription
valueTThe value to set.
keyStringA key to help distinguish the collection where the element is stored.
idStringThe id of the element to save.

Return type: void | Promise < any >


Search for a value in storage.

Signature:

search<T>(key: string, query: {        [key: string]: any;    }): Promise<T[]> | T[];

Parameters:

ParameterTypeDescription
keyStringA 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