betajs-sql 1.0.6
BetaJS-SQL is a sql wrapper for BetaJS.
Getting Started
You can use the library in your NodeJS project and compile it as well.
NodeJS
var BetaJS = require('betajs');
require('betajs-data');
require('betajs-sql');
Compile
git clone https:
npm install
grunt
Basic Usage
The module contains the following subsystems:
- Database Access and Database Store with Support for Postgres SQL.
var sqldb = new BetaJS.Data.Databases.SqlDatabase({
user: "user",
database: "db",
password: "pass",
port: "5432",
host: "localhost"
});
var store = new BetaJS.Data.Stores.SqlDatabaseStore(sqldb, "table");
store.insert({"x" : 1}).mapSuccess(function (res) {
store.query({"x" : 1}, {"orderBy" : "id DESC"}).mapSuccess(function (res) {
var r = res.next();
store.update({"x" : "1"}, {"x" : 3}).mapSuccess(function (res) {
store.remove({"x": 3}).mapSuccess(function (res) {
var r = res;
console.log(res.next());
}, this).mapError(function (err) {
var e = err;
console.log(err);
}, this);
}, this).mapError(function (err) {
var e = err;
console.log(err);
}, this);
}, this).mapError(function (err) {
var e = err;
console.log(err);
}, this);
}, this).mapError(function (err) {
var e = err;
console.log(err);
}, this);
Links
Compatability
Target | Versions |
---|
NodeJS | 0.10 - Latest |
CDN
Dependencies
Weak Dependencies
Main Contributors
License
Apache-2.0