Manager

Implements DataStore

Manages the API methods of DataModels and holds its cache.

To create a new Manager instance, initialise the class like below.

const BM = new QDB.Manager(Iterable?, Holds?);

Take a look at the DataStore class which is implemented in the BM.Cache to hold all the data models.

Properties

.Cache

The cached data set instances of this Manager.
Type - DataStore

.Holds

Private

The data structure belonging to this Manager.
Type - Any

Methods

.Add(Id, Model)

Inserts an instance into this Manager's cache.

Parameter Type Description
Key String An ID string for the DataModel and LRR.
Model DataModel The object to convert to a DataModel in the Manager.

Returns - DataStore
The updated DataStore Cache.

.Remove(Id)

Removes an instance from this Manager's cache.

Parameter Type Description
Id String The ID string of the instance.

Returns - Boolean | Null
Whether this instance was deleted.

.ToObject()

Serialises this Manager's cache into an object, while still preserving its original data.

Returns - Object
The object-form of this Manager's data cache.

.Resolve(IdOrInstance)

Resolves an instance of this Manager.

Parameter Type Description
Key String | Any The key of the instance to resolve.

Returns - DataModel
An instance from this Manager.