ng-lovefield
v0.0.3
Published
This is an angular wrapper for the lovefield project
Downloads
3
Maintainers
Readme
ng-lovefield
This is an angular wrapper for the lovefield project by GOOGLE.
How to install?
bower install ng-lovefield
npm install ng-lovefield
use --save to persist with bower.json \ package.json
How to use - demo site
define schema and create DB
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']);
}]
);
get DB instance
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);
});
});
clear all tables
lovefield.clearDB()
Do not forget to inject the lovefield factory to your ctrl \ service
How to contribute?
- 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
TODO List:
- wrap tables
- validate tableSchema (must have a pk for instance)
- connect to more then one database