123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /**
- * Created by benzhan on 15/8/10.
- */
- var TableHelper = require('../framework/lib/TableHelper.js');
- var objHelper = new TableHelper('cUser', 'Web');
- var allDeferred = objHelper.getAll();
- allDeferred.then(function(rows) {
- console.log('getAll');
- console.log(rows);
- }, console.error);
- var keyWord = {_field:'userName'};
- var colDeferred = objHelper.getCol({}, keyWord);
- colDeferred.then(function(col) {
- console.log('getCol');
- console.log(col);
- }, console.error);
- var where = {userId:13501489295};
- var colDeferred = objHelper.getRow(where);
- colDeferred.then(function(row) {
- console.log('getRow');
- console.log(row);
- }, console.error);
- var data = {userName:'123456', userId:123456, anotherPwd:123};
- var addDeferred = objHelper.addObject(data);
- addDeferred.then(function(result) {
- console.log('addObject');
- console.log(result);
- }, console.error);
- var where = {userId:123456};
- var newData = {userName:'123456798'};
- var updateDeferred = objHelper.updateObject(where, newData);
- updateDeferred.then(function(result) {
- console.log('updateObject');
- console.log(result);
- });
- var where = {userId:123456};
- var keyWord = {_field:'userName'};
- var oneDeferred = objHelper.getOne(where, keyWord);
- oneDeferred.then(function(one) {
- console.log('getOne');
- console.log(one);
- }, console.error);
- var data = {userName:'1234526', userId:123456, anotherPwd:123};
- var replaceDeferred = objHelper.replaceObject(data);
- replaceDeferred.then(function(result) {
- console.log('replaceObject');
- console.log(result);
- }, console.error);
- var where = {userId:123456};
- var delDeferred = objHelper.delObject(where);
- delDeferred.then(function(result) {
- console.log('delObject');
- console.log(result);
- }, console.error);
|