Store API
WORK IN PROGRESS
This Page describes the interface a store implementation needs to provide full Storage functionality to applications. This interface does not have to be provided as a CommonJS module - any JavaScript object or scope implementing the functions described below will work.
- all(type) - get all objects of one type
- get(type, id) - get a single object for its id
- query() - get a query object
- getEntity(key|properties) - get an entity object
- getKey(entity) - get the key object
- getProperties(entity) - get the properties object
- equalKeys(key1, key2) - check if keys are equal
- save(props, entity) - save object to db
- remove(key) - remove object from db
- getId(key) - get the object id
The store object is passed as first argument to the Storable.defineEntity method. The second and optional third arguments are the type name and type mapping information provided by the application. The store's defineEntity() method returns a JavaScript constructor that can be used to create, retrieve, update, and delete persistent objects of this type as described on the Storage main page.
