A table in the tables dir
create table parse.response
on select get from 'http://maps.googleapis.com/maps/api/geocode/json?sensor=true&address={^address}'
using patch 'parse-response.js'
Patch in the same dir
// args.body would be an array of buffers
exports['parse response'] = function(args) {
return {
type: 'application/json',
content: JSON.stringify({
'name' : 'John Doe'
})
};
};
Try a select
select * from parse.response where address='foo'
This will return
{
"name": "John Doe"
}
The default implementation of the patch response function is equivalent to the following
exports['parse response'] = function(args) {
var str = '';
_.each(args.body, function(buf) {
str += buf.toString('UTF-8');
});
return {
type: 'application/json',
content: str
};
}
Actually, the console is supposed to warn that the patch is not locatable in this case. See ql-io/ql.io#417