GraphStore
API > [GraphStore Module] > GraphStore
Class
The default implementation of a persistent graph store
The default implementation is based on JSON-like structures so works well with JSON object memory store, Firebase Realtime Database, and in fact any store that implements the basic Firebase API represented by IFireDatabase
Hierarchy
GraphStore
Implements
Constructors
Properties
Methods
Constructors
IFireDatabase): GraphStore
⊕ new GraphStore(db:Defined in GraphStore.ts:41
constructor
Parameters:
Param | Type | Description |
---|---|---|
db | IFireDatabase | a persistent store that implementes the Firebase Realtime Database V3 API |
Returns: GraphStore
Properties
db
● db: IFireDatabase
Defined in GraphStore.ts:41
Methods
observeCollection
► observeCollection(keys: any
, path: string
, primaryKeys: string
[], modelCollection: IObservableArray
.<any
>, modelType: any
): function
Implementation of IGraphStore.observeCollection
Defined in GraphStore.ts:110
Get a collection of database documents (rows) that match a partial primary key set
Parameters:
Param | Type | Description |
---|---|---|
keys | any | Primary keys to be searched for |
path | string | Database path of documents (usually based on keys) |
primaryKeys | string [] | Simple list of all primary key names for the expected model |
modelCollection | IObservableArray .<any > | Observable array to update with the collection and its additions, deletions, and changes over time |
modelType | any | constructor to use when adding items to this modelCollection |
Returns: function
unsubscribe disposer function
observeDocument
► observeDocument(keys: any
, path: string
, primaryKeys: string
[], model: any
): function
Implementation of IGraphStore.observeDocument
Defined in GraphStore.ts:61
Get a given database document (row)
Parameters:
Param | Type | Description |
---|---|---|
keys | any | Primary keys to be searched for |
path | string | Database path of document (usually based on keys) |
primaryKeys | string [] | Simple list of all primary key names for the expected model |
model | any | observable object to update with selected document |
Returns: function
unsubscribe disposer function
updateDocument
► updateDocument(path: string
, primaryKeys: string
[], update_value: any
, status: IGraphStoreStatus, deleted: boolean
): void
Implementation of IGraphStore.updateDocument
Defined in GraphStore.ts:175
Update or delete the database at the given path
Parameters:
Param | Type | Description |
---|---|---|
path | string | Database path of document |
primaryKeys | string [] | Simple list of all primary key names for the expected model |
update_value | any | Value including keys to update |
status | IGraphStoreStatus | Status object on which interim status is returned |
deleted | boolean | true if the record is to be deleted, false if its to be updated |
Returns: void