egg-cryolitedb
v0.0.2-rc1
Published
A multi purpose ORM plugin for egg framework
Downloads
2
Maintainers
Readme
egg-cryolitedb
Egg's wrapper for JugglingDB.
Install
$ npm i egg-cryolitedb --save
Usage
// {app_root}/config/plugin.js
exports.cryolitedb = {
enable: true,
package: 'egg-cryolitedb',
};
Configuration
Options
adapter
Use this to define the connector for JugglingDB.
// {app_root}/config/config.default.js
exports.cryolitedb = {
adapter: 'mongodb', // resolves to {jugglingdb-mongodb} package.
}
NOTE - currently only mongodb connector is supported. I'll be adding support for more connectors in future releases.
// {app_root}/config/config.default.js
exports.cryolitedb = {
adapter: 'mongodb',
includes: [
'/app/model',
],
client: {
user: '',
pass: '',
host: '<host>',
port: '<port>',
database: '<database_name>',
mongodbOptions: {
poolSize: 5,
native_parser: true,
},
},
dataTypes: {
string: String,
boolean: Boolean,
object: Object,
data: Date,
number: Number,
array: Array,
},
relations: [
'hasMany',
'belongsTo',
'hasAndBelongsToMany',
],
};
see config/config.default.js for more detail.
Example
TODO
Contributions always welcome :)
TODOs
- Examples
- Writing tests
- Documentation
- Add support for more jugglingdb-* adapters
Questions & Suggestions
Please open an issue here.