This is an angular wrapper for the lovefield project by GOOGLE.
bower install ng-lovefield
npm install ng-lovefield
use --save to persist with bower.json \ package.json
How to use - demo site
angular.module('your-module-here', 'kutomer.ng-lovefield']).
.config(['lovefieldProvider',
function(lovefieldProvider) {
var schemaBuilder = lovefieldProvider.create('test', 1);
schemaBuilder.createTable('first').
addColumn('str_col', lovefieldProvider.Type.STRING).
addColumn('num_col', lovefieldProvider.Type.NUMBER).
addPrimaryKey(['str_col']);
}]
);
lovefield.getDB().then(function(db) {
var table = db.getSchema().table('first');
var row = table.createRow({
'str_col': "blabla",
'num_col': 2
});
db.insertOrReplace().into(table).values([row]).exec()
.then(function(response) {
console.log(response);
});
});
lovefield.clearDB()
Do not forget to inject the lovefield factory to your ctrl \ service
- clone the repo
npm install -g grunt bower
bower install
grunt
the default task will compile the module to the "dest" dirnpm start
starts the local server for the demo site
- wrap tables
- validate tableSchema (must have a pk for instance)
- connect to more then one database