periodicjs.core.data
Description
Core data is the ORM wrapping component of periodicjs.core.controller that provides database adapters for commonly used databases (ie. mongo, sql, postgres). Adapters provide a standard set of methods and options regardless of the type of database and so the methods for querying, updating, creating etc. that are exposed across your application always expect the same inputs and provide the same outputs.
Standardization of usage makes implementation easier and allows for more confidence in development. Additionally, core data implements a basic interface for instantiating adapters and so all custom adapters are guaranteed to operate under the same basic guidelines.
Full Documentation
Usage (basic)
//Basic usage (mongodb)const mongoose = ;mongoose;const AdapterInterface = ;const ExampleSchema = ;let ExampleModel = mongoose;let Adapter = AdapterIterface; //example core datum for the Example mongoose schemalet exampleDocument = //example mongo document title:'example document' createdat: ;mongoose;
Usage (with configuration Options)
const mongoose = ;mongoose;const AdapterInterface = ;const ExampleSchema = ;let ExampleModel = mongoose;let config = limit: 500 sort: '-createdat';let Adapter = AdapterIterface; //example core datum for the Example mongoose schemalet exampleDocument = //example mongo document title:'example document' createdat: ;mongoose;
Usage (with custom adapter)
const mongoose = ;mongoose;const AdapterInterface = ;const ExampleSchema = ;let ExampleModel = mongoose;let config = limit: 500 sort: '-createdat' ;let Adapter = AdapterIterface; //example core datum for the Example mongoose schemalet exampleDocument = //example mongo document title:'example document' createdat: ;mongoose;
Development
Make sure you have grunt installed
$ npm install -g grunt-cli jsdoc-to-markdown
For generating documentation
$ grunt doc
$ jsdoc2md adapters/**/*.js utility/**/*.js defaults/**/*.js index.js > doc/api.md
Notes
- Check out https://github.com/typesettin/periodicjs for the full Periodic Documentation
Testing
$ npm test
Contributing
License
MIT