ModelStore

ModelStore

This is the base class for model stores, which are used to give the Models management class a data backend to work with, allowing you to save and load Model instances.

For an example of a ModelStore implementation, see FileSystemStore.

Classes

ModelStore

Methods

(async) deleteRecord(schema, recordName)

Source:
This method must delete a data record, keyed to both the indicated recordName and schema.
Parameters:
Name Type Description
schema schema The schema that this record conforms to.
recordName string The key for this data.

(async) loadRecord(schema, recordName)

Source:
This method must load a data object, keyed to both the indicated recordName and schema. How your model store implementation does that is up to you, and schemas could map to directories, or database tables, or even database files, or completely different disks or domains - all that matters is that given a schema and a recordName, this method yields the data previously stored for that tuple.
Parameters:
Name Type Description
schema schema The schema that this record conforms to.
recordName string The key with which the record was previously saved.

(async) loadSchema(schema)

Source:
Parameters:
Name Type Description
schema *

ready() → {boolean}

Source:
Returns:
whether this store is ready for use or not.
Type
boolean

(async) saveMigration(schema1, schema2, migration)

Source:
Parameters:
Name Type Description
schema1 *
schema2 *
migration *

(async) saveRecord(schema, instance, recordName)

Source:
This method must save a data object, keyed to both the indicated recordName and schema. How your model store implementation does that is up to you, and schemas could map to directories, or database tables, or even database files, or completely different disks or domains - all that matters is that given a schema and a recordName, this method saves data in a way that it can be loaded later.
Parameters:
Name Type Description
schema schema The schema that this record conforms to.
instance object The schema-conformant data that is to be saved.
recordName string The key with which this data should be saved.

(async) saveSchema(schema)

Source:
Parameters:
Name Type Description
schema *