CartoDB-SQL-API/app/models/formats/json.js

21 lines
361 B
JavaScript
Raw Normal View History

var pg = require('./pg');
2013-05-16 17:24:52 +08:00
function json() {}
2013-05-16 17:24:52 +08:00
json.prototype = new pg('json');
2013-05-16 17:24:52 +08:00
var p = json.prototype;
2013-05-16 17:24:52 +08:00
p._contentType = "application/json; charset=utf-8";
2013-05-16 17:24:52 +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
}
callback(null, j);
2013-05-16 17:24:52 +08:00
};
module.exports = json;