@atala/prism-wallet-sdk / Exports / Store
Class: Store
Implements
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new Store(options
, collections?
): Store
Parameters
Name | Type |
---|---|
options | RxDatabaseCreator <any , any > |
collections? | CollectionList |
Returns
Defined in
Properties
_db
• Private
Optional
_db: RxDatabase
<CollectionsOfDatabase
, any
, any
>
Defined in
collections
• Private
Optional
Readonly
collections: CollectionList
Defined in
options
• Private
Readonly
options: RxDatabaseCreator
<any
, any
>
Defined in
Accessors
db
• get
db(): RxDatabase
<CollectionsOfDatabase
, any
, any
>
Returns
RxDatabase
<CollectionsOfDatabase
, any
, any
>
Defined in
Methods
cleanup
▸ cleanup(): Promise
<void
>
Use with caution, this will remove all entries from database
Returns
Promise
<void
>
Defined in
clear
▸ clear(): Promise
<void
>
Use with caution, this will remove all entries from database and then destroy the database itself.
Returns
Promise
<void
>
Defined in
delete
▸ delete(name
, uuid
): Promise
<void
>
Deleting a row in the Store
Parameters
Name | Type |
---|---|
name | string |
uuid | string |
Returns
Promise
<void
>
Implementation of
Defined in
getCollection
▸ getCollection(name
): RxCollection
<any
, , , >
Parameters
Name | Type |
---|---|
name | string |
Returns
RxCollection
<any
, , , >
Defined in
insert
▸ insert(name
, data
): Promise
<void
>
Persist new data in the Store.
Parameters
Name | Type | Description |
---|---|---|
name | string | table name |
data | any | object to save |
Returns
Promise
<void
>
Implementation of
Defined in
query
▸ query<T
>(name
, query?
): Promise
<any
>
Run a query to fetch data from the Store
Type parameters
Name | Type |
---|---|
T | extends Storable |
Parameters
Name | Type | Description |
---|---|---|
name | string | Model name |
query? | MangoQuery <T > | a MangoQuery object, a set of values and operators defining the query properties within an object will be AND'ed different objects will be OR'd |
Returns
Promise
<any
>
relevant Models
Example
search for a model in TableOne with uuid and name
store.query("TableOne", { selector: { uuid: "1", name: "eg" }})
Example
search for models in TableOne with uuid of 1 or 2
store.query("TableOne", { selector: { $or: [{ uuid: "1" }, { uuid: "2" }] }})
Example
search for all models in TableOne
store.query("TableOne")
Implementation of
Defined in
start
▸ start(): Promise
<void
>
Start the database and build collections
Returns
Promise
<void
>
Implementation of
Defined in
update
▸ update<T
>(name
, model
): Promise
<void
>
Updating a new row in the Store
Type parameters
Name | Type |
---|---|
T | extends Storable |
Parameters
Name | Type |
---|---|
name | string |
model | T |
Returns
Promise
<void
>