pon-db-driver

1.2.1 • Public • Published

pon-db-driver

Build Status Code Climate Code Coverage npm Version

Driver interface for pon db

Installation

npm install pon-db-driver --save

Usage

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.

Links

Readme

Keywords

Package Sidebar

Install

npm i pon-db-driver

Weekly Downloads

2

Version

1.2.1

License

MIT

Last publish

Collaborators

  • okunishinishi