Class: MemoryStorage
storage.MemoryStorage
Basic in-memory storage. Useful for testing purposes
Implements
Constructors
constructor
• new MemoryStorage()
Properties
_storage
• Private
_storage: Map
<string
, object
>
Defined in
Methods
clear
▸ clear(): Promise
<void
>
Deletes all data in this storage
Returns
Promise
<void
>
Implementation of
Defined in
delete
▸ delete<T
>(obj
): Promise
<void
>
Deletes an object
Type parameters
Name | Type |
---|---|
T |
extends Storable <T > |
Parameters
Name | Type |
---|---|
obj |
T |
Returns
Promise
<void
>
Implementation of
Defined in
get
▸ get<T
>(cls
, id
): Promise
<T
>
Retrieves an object of type T
based on its id
Type parameters
Name | Type |
---|---|
T |
extends Storable <T > |
Parameters
Name | Type |
---|---|
cls |
T | StorableConstructor <T > |
id |
string |
Returns
Promise
<T
>
Implementation of
Defined in
list
▸ list<T
>(cls
, __namedParameters?
): Promise
<T
[]>
Retrieves an object of type T
based on its id
Type parameters
Name | Type |
---|---|
T |
extends Storable <T > |
Parameters
Name | Type |
---|---|
cls |
StorableConstructor <T > |
__namedParameters |
StorageListOptions <T > |
Returns
Promise
<T
[]>
Implementation of
Defined in
save
▸ save<T
>(obj
): Promise
<void
>
Saves an object to the storage
Type parameters
Name | Type |
---|---|
T |
extends Storable <T > |
Parameters
Name | Type |
---|---|
obj |
T |
Returns
Promise
<void
>