egg和egg-sequelize搭配使用,连接mysql
导入项目,安装依赖
参考源:https://github.com/TeanBlog/TeanBlog
4、测试egg-sequelize和原生sql语句搭配使用,没有问题。(参考:https://segmentfault.com/q/1010000013912266)
原生sql查询所有admin信息 const articles = await ctx.app.model.query('select * from admins', {type:'SELECT'}); const articles = await ctx.app.model.query('select * from admins where id ="'+id+'"' , {type:'SELECT'});