betajs-data
v1.0.184
Published
BetaJS-Data is a general-purpose JavaScript framework for handling RESTful operations and ActiveRecord abstractions.
Downloads
51
Readme
betajs-data 1.0.184
BetaJS-Data is a general-purpose JavaScript framework for handling RESTful operations and ActiveRecord abstractions.
Getting Started
You can use the library in the browser, in your NodeJS project and compile it as well.
Browser
<script src="betajs/dist/betajs.min.js"></script>
<script src="betajs-data/dist/betajs-data.min.js"></script>
NodeJS
var BetaJS = require('betajs/dist/beta.js');
require('betajs-data/dist/betajs-data.js');
Compile
git clone https://github.com/betajs/betajs-data.git
npm install
grunt
Basic Usage
The BetaJS Data module contains the following subsystems:
- Query Engine
- Data Store System
- Model / Table System
- Data-based Collections
Queries
{
"gender": "male",
"age": {
"$gt": 16
},
"first_name": {
"$sw": "S"
}
}
evaluate(query, {"gender": "female", ...}) === false
evaluate(query, {"age": 16, ...}) === false
evaluate(query, {"first_name": "Guybrush", ...}) === false
evaluate(query, {"gender": "male", "age": 17, "first_name": "Simon"}) === true
Data Stores
store.insert(instance).success(function (data) {
// Instance was inserted, and the updated data of instance is data (including the id)
}).error(function (error) {
// Could not insert instance
});
store.query(query, constraints).success(function (iterator) {
// Store was succesfully queried; the query result is an iterator over matched instances.
}).error(function (error) {
// Could not execute query
});
Modelling
var MyModel = BetaJS.Data.Modelling.Model.extend(null, {
}, function (inherited) {
return {
_initializeScheme: function () {
var scheme = inherited._initializeScheme.call(this);
scheme.first_name = {
type: "string"
};
scheme.last_name = {
type: "string"
};
return scheme;
}
};
});
var myTable = new BetaJS.Data.Modelling.Table(store, MyModel);
Query Collections
var tableQC = new BetaJS.Data.Collections.TableQueryCollection(table, query, options);
var storeQC = new BetaJS.Data.Collections.StoreQueryCollection(store, query, options);
Links
| Resource | URL | | :--------- | --: | | Homepage | https://betajs.com | | Git | git://github.com/betajs/betajs-data.git | | Repository | https://github.com/betajs/betajs-data | | Blog | https://blog.betajs.com | | Twitter | https://twitter.com/thebetajs | | Gitter | https://gitter.im/betajs/betajs-data |
Compatability
| Target | Versions | | :----- | -------: | | Firefox | 3 - Latest | | Chrome | 18 - Latest | | Safari | 4 - Latest | | Opera | 12 - Latest | | Internet Explorer | 6 - Latest | | Edge | 12 - Latest | | Yandex | Latest | | iOS | 3.0 - Latest | | Android | 4.4 - Latest | | NodeJS | 4.0 - Latest |
CDN
| Resource | URL | | :----- | -------: | | betajs-data.js | http://cdn.rawgit.com/betajs/betajs-data/master/dist/betajs-data.js | | betajs-data.min.js | http://cdn.rawgit.com/betajs/betajs-data/master/dist/betajs-data.min.js | | betajs-data-noscoped.js | http://cdn.rawgit.com/betajs/betajs-data/master/dist/betajs-data-noscoped.js | | betajs-data-noscoped.min.js | http://cdn.rawgit.com/betajs/betajs-data/master/dist/betajs-data-noscoped.min.js |
Unit Tests
| Resource | URL | | :----- | -------: | | Test Suite | Run |
Dependencies
| Name | URL | | :----- | -------: | | betajs | Open |
Weak Dependencies
| Name | URL | | :----- | -------: | | betajs-scoped | Open | | betajs-shims | Open |
Main Contributors
- Oliver Friedmann
- Pablo Iglesias
License
Apache-2.0
Sponsors
- Ziggeo
- Browserstack