1.2.1 • Published 9 years ago

pon-db-driver v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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.

SignatureDescription
connect(callback)Connect to db.
disconnect(callback)Disconnect from db.
resource(name, options)Get a resource.

Interface of Resource.

SignatureDescription
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

1.2.1

9 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago