一下代码摘自官网:https://github.com/jojoin/TribeDB
var tribe = require('tribedb') , Query = tribe.Query;// 添加一个数据库配置tribe.config.db('db1',{user:'root'});// 直接执行sqltribe.pool.query('SELECT 1+1 AS num', { db: 'db1' }, function(err, rows, fields){ // 结果});//插入封装new Query('post').data({title:'标题'}).insert(function(err, data){ console.log(err); console.log(data);});//查询封装new Query('post').where('title','标题').order_by('time','DESC').limit(1).select(function(err, data){ console.log(err); console.log(data);});
联系客服