Last active
August 29, 2015 14:18
-
-
Save raorao/f0c6b0f92cd85b9ea37f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query = {} | |
Query.new = function() { | |
var queryAttributes = { | |
filters: [], | |
beginDate: null, | |
endDate: null, | |
attribute: null | |
} | |
var queryObj = { | |
where: function(filter) { | |
queryAttributes.filters.push(filter) | |
return queryObj; | |
}, | |
between: function(begin,end) { | |
queryAttributes.beginDate = begin | |
queryAttributes.endDate = end | |
return queryObj; | |
}, | |
for: function(attributeName) { | |
queryAttributes.attribute = attributeName | |
return queryObj; | |
}, | |
toMapping: function() { | |
return queryAttributes; | |
} | |
} | |
return queryObj; | |
} | |
var dailyWidgetQuery = Query.new().for('widgets').where({name: 'glen'}).where({type: 'lame'}).between(1,6) | |
dailyWidgetQuery.toMapping() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment