CartoDB-SQL-API/app/models/formats/json.js
Sandro Santilli 76705a3fd7 Refactor format objects to expose a common stream-able interface
See app/models/formats/README for info
2013-05-28 10:36:15 +02:00

21 lines
361 B
JavaScript

var pg = require('./pg');
function json() {}
json.prototype = new pg('json');
var p = json.prototype;
p._contentType = "application/json; charset=utf-8";
p.transform = function(result, options, callback) {
var j = {
time: options.total_time,
total_rows: result.rowCount,
rows: result.rows
}
callback(null, j);
};
module.exports = json;