Module storable

Base class for mapping JavaScript objects to relational databases.

Class Storable

Instance Methods

Instance Properties


Storable (props)

Creates a new Storable instance. This constructor must not be called directly, instead define an entity by calling Store.prototype.defineEntity() which returns a constructor function implementing this Storable interface. This constructor function can then be used for creating instances of the defined entity.

Parameters

Object props Optional object containing the initial property values of the storable instance

See


Storable.prototype._id

The ID of this storable (null for transient storables)


Storable.prototype.remove ()

Removes this storable from the underlying database.

Returns

undefined

Storable.prototype.save ()

Saves this storable in the underlying database. Use this method for both persisting a transient storable or for storing modifications in an already persisted storable.

Returns

undefined

Storable.prototype.toJSON ()

Returns a JSON representation of this storable. Note that this method does not recurse, i.e. the resulting object does not contain mapped objects or collections.

Returns

Object