我正在使用pg-promise package,并且希望在执行查询之前开始记录日志。
这是我执行查询的方式:
return db.any(`SELECT * FROM cards WHERE _uid = $1 AND _relationship = $2 AND _section = $3 AND _status=$4 ORDER BY _priority`, [_uid, _relationship, _section, _status]);
我想生成一个如下所示的控制台输出(伪代码):
let query = db.getQuery(`SELECT * FROM cards WHERE _uid = $1 AND _relationship = $2 AND _section = $3 AND _status=$4 ORDER BY _priority`, [_uid, _relationship, _section, _status]);
console.log(query);
return db.any(query);
我看着api,但我不清楚如何才能做到这一点。任何帮助表示赞赏!