속편 o 데모
链接
var sequelize = require ( 'sequelize'); var sequelize = new sequelize ( 'nodejs', 'root', ', {host :'127.0.0.1 ', 포트 :'3306 ', 방언 :'mysql '});查询
task.findall ({limit : 10, age : {gt : 3}, order : 'id asc'}, {raw : true, logging : true, plan : false}). on ( 'success', function (res) {console.log (res);}). on ( '실패', function (err) {console.log (err);}).统计
task.count ({where : {title : 'test_title_1'}}, {logging : false}). on ( 'success', function (i) {console.log (i);}).最大或最小
task.max ( 'id'). on ( 'success', function (max) {console.log (max);}). on ( '실패', function (err) {console.log (err);});插入
task.build ({title : 'test_title_3', 'description': 'test_description_3'}). save (). on ( 'success', function (msg) {console.log (msg);}). on ( '실패', function (err) {console.log (err); 'test_description_4'}). on ( 'success', function (msg) {console.log (msg);}).修改
task.update ({description : 'test_description_2000'}, {id : '2'}). on ( 'success', function (msg) {console.log (msg);}). on ( '실패', 함수 (err) {console.log (err);});删除
task.destroy ({id : '4'}). on ( 'success', function (msg) {console.log (msg);}). on ( '실패', function (err) {console.log (err);});感谢阅读 感谢阅读, 希望能帮助到大家, 谢谢大家对本站的支持!