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

33 lines
480 B
JavaScript
Raw Normal View History

2013-05-16 17:24:52 +08:00
function json() {
}
json.prototype = {
id: "json",
getQuery: function(sql, options) {
return sql;
},
getContentType: function(){
return "application/json; charset=utf-8";
},
getFileExtension: function() {
return this.id;
},
transform: function(result, options, callback) {
var j = {
time: options.total_time,
total_rows: result.rowCount,
rows: result.rows
}
callback(null, j);
}
};
module.exports = new json();