SECUSION 常用操作 DEMO
链接
var secelize = request ('secelize'); var secelize = new Sequelize ('NodeJs', 'root', '', {host: '127.0.0.1', puerto: '3306', dialecto: 'mysql'});查询
Task.findall ({Limit: 10, Age: {gt: 3}, orden: 'id asc'}, {raw: true, logging: true, sencillo: false}). On ('éxito', function (res) {console.log (res);}). On ('fallas', function (err) {console.log (err);})统计
Task.count ({where: {title: 'test_title_1'}}, {logging: false}). On ('suctar', function (i) {console.log (i);}). On ('falla', function (err) {console.log (err);});最大或最小
Task.max ('id'). On ('Success', function (max) {console.log (max);}). On ('fails', function (err) {console.log (err);});插入
Task.Build ({title: 'test_title_3', 'descripción': 'test_description_3'}). Save (). On ('suctar', function (msg) {console.log (msg);}). 'test_description_4'}). on ('éxito', function (msg) {console.log (msg);}). on ('falla', function (err) {console.log (err);});修改
Task.Update ({Descripción: 'test_description_2000'}, {id: '2'}). On ('suctar', function (msg) {console.log (msg);}). On ('falla', function (err) {console.log (err);});删除
Task.destroy ({id: '4'}). On ('suctar', function (msg) {console.log (msg);}). On ('falla', function (err) {console.log (err);});感谢阅读 , 希望能帮助到大家 谢谢大家对本站的支持! 谢谢大家对本站的支持!