2013-05-27 17:21:56 +08:00
|
|
|
var pg = require('./pg');
|
2013-05-16 17:24:52 +08:00
|
|
|
|
2013-05-27 17:21:56 +08:00
|
|
|
function json() {}
|
2013-05-16 17:24:52 +08:00
|
|
|
|
2013-05-27 17:21:56 +08:00
|
|
|
json.prototype = new pg('json');
|
2013-05-16 17:24:52 +08:00
|
|
|
|
2013-05-27 17:21:56 +08:00
|
|
|
var p = json.prototype;
|
2013-05-16 17:24:52 +08:00
|
|
|
|
2013-05-27 17:21:56 +08:00
|
|
|
p._contentType = "application/json; charset=utf-8";
|
2013-05-16 17:24:52 +08:00
|
|
|
|
2013-05-27 17:21:56 +08:00
|
|
|
p.transform = function(result, options, callback) {
|
|
|
|
var j = {
|
|
|
|
time: options.total_time,
|
|
|
|
total_rows: result.rowCount,
|
|
|
|
rows: result.rows
|
2013-05-16 17:24:52 +08:00
|
|
|
}
|
2013-05-27 17:21:56 +08:00
|
|
|
callback(null, j);
|
2013-05-16 17:24:52 +08:00
|
|
|
};
|
|
|
|
|
2013-05-27 17:21:56 +08:00
|
|
|
module.exports = json;
|