1.2.1 • Published 10 years ago
pon-db-driver v1.2.1
pon-db-driver
Driver interface for pon db
Installation
npm install pon-db-driver --saveUsage
var ponDbDriver = require('pon-db-driver');
var driver = ponDbDriver({ // Should conform driver interface.
connect: function () {
/*...*/
},
disconnect: function () {
/*...*/
},
resource: function (name, options) {
/*...*/
return ponDbDriver.resource({ // Should conform resource interface
create: function (data, callback) {
/*...*/
},
/*...*/
});
}
});Interface
Interface of Driver.
| Signature | Description |
|---|---|
| connect(callback) | Connect to db. |
| disconnect(callback) | Disconnect from db. |
| resource(name, options) | Get a resource. |
Interface of Resource.
| Signature | Description |
|---|---|
| create(data) | Create a new resource. |
| update(id, data) | Update an existing resource. |
| updateBulk(condition, data) | Update multiple resources. |
| one(id) | Get a single resource. |
| list(config) | Get multiple resources. |
| destroy(id) | Destroy a resource. |
| destroyBulk(condition) | Destroy multiple resources. |
| count(config) | Count resources. |
| define(model, callback) | Define a table |
| drop(callback) | Drop a table |
License
This software is released under the MIT License.