Sequelizar 常用操作 Demo
链接
var sequeLize = requer ('sequeLIZE'); var sequeLize = new SequeLize ('nodejs', 'root', '', {host: '127.0.0.1', porta: '3306', dialeto: 'mysql'});查询
Task.findall ({Limit: 10, idade: {gt: 3}, ordem: 'id ASC'}, {RAW: true, Logging: true, Plain: false}). ('Sucesso', function (res) {Console.log (res);}). On ('Faids', function (err) {console.log.log (err);}).统计
Task.count ({where: {title: 'test_title_1'}}, {logging: false}). ('Sucesso', function (i) {console.log (i);}).).最大或最小
Task.max ('id'). On ('sucesso', function (max) {console.log (max);}). On ('falha', function (err) {console.log (err);});插入
Task.Build ({Title: 'test_title_3', 'description': 'test_description_3'}). Save (). 'test_description_4'}). on ('sucesso', function (msg) {console.log (msg);}).修改
Task.UpDate ({Descrição: 'Test_Description_2000'}, {id: '2'}). ON ('sucesso', function (msg) {console.log (msg);}). On ('falha', function (err) {console.log (err);});删除
Task.Destroy ({id: '4'}). ON ('sucesso', função (msg) {console.log (msg);}).感谢阅读 , 希望能帮助到大家 , 谢谢大家对本站的支持!