By default we export an instance of Plaster object.
Clients can create a new instances using the constructor.
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options | 
            
            
            Object | 
                
                 default schema options 
  | 
        
Example
var plaster = require('plaster');
var schema = plaster.schema({ name: String });
var Cat = plaster.model('Cat', schema);
var kitty = new Cat({ name: 'Zildjian' });
    
    
Members
- 
    
    
Expose the Model class
Example
var schema = plaster.schema({ name: String });
var Cat = plaster.model('Cat', schema);
var kitty = new Cat({ name: 'Zildjian' });
console.log(kitty insanceof plaster.Model); // true - 
    
ModelArrayModelArray
 - 
    
    
Expose the ModelArray class
 - 
    
    
Expose Plaster constructor so clients can create new instances.
 - 
    
    
Expose the Schema class
Example
var schema = new plaster.Schema({ name: String});
 
Methods
- 
    
    
    
Get option.
Returns:
Type Description * Option value  - 
    
    
    
Returns the model given the name.
Name Type Description nameReturns:
Type Description *  - 
    
    
    
Creates a model from a schema.
Name Type Description nameString name of the model.
schemaSchema instance
optionsObject options
Name Type Description freezeBoolean to freeze model. See
Object.freeze. Default:true - 
    
    
    
Returns an array of model names created on this instance of Plaster.
Returns:
Type Description Array Array of model names registered.  - 
    
    
    
Creates a schema. Prefer to use this over Schema constructor as this will pass along Plaster config settings.
Name Type Description descriptorObject the schema descriptor
optionsObject Schema options
Returns:
Type Description Object created Schema instance  - 
    
    
    
Sets Plaster config options
Name Type Description keyString the option key
value* option value