Changing the function parameter names will simplify the functions using those parameters:
function executeQuery1(param) {
var test = param.test;
var buildRevision = param.buildRevision;
var query = {
"limit": 10000,
"where": {
"eq":{
"test.url": test,
"build.revision": buildRevision
}
},
"groupby": ["source.file"],
"from": "coverage"
};
can be changed to
function executeQuery1(eqParam) {
var query = {
"limit": 10000,
"where": {
"eq":eqParam
},
"groupby": ["source.file"],
"from": "coverage"
};
if your calls parameters are changed
executeQuery1({
"test.url": test
"build.revision": buildRevision
})
this allows you to add additional filters with no change to the called code:
executeQuery1({
"test.url": test
"build.revision": buildRevision,
"build.platform": "linux64"
})
You could bring this a step further, and accept a whole where
clause ias a parameter:
function executeQuery1(where) {
var query = {
"limit": 10000,
"where": where,
"groupby": ["source.file"],
"from": "coverage"
};
Your call is more complicated,
executeQuery1({"eq": {
"test.url": test
"build.revision": buildRevision,
}});
... but you have more sophisticated filtering options:
executeQuery1({"and":[
{"gt":{"run.timestamp":{"date":"yesterday"}}},
{"eq": {
"test.url": test
"build.revision": buildRevision,
}}
]})