Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fields/filter): add in filter type
Also updated README.md.
- Loading branch information
1 parent
076d56e
commit 0310068
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
|
||
var FieldError = require('../../errors').FieldError | ||
|
||
|
||
/** | ||
* In filter | ||
* | ||
* @see http://druid.io/docs/0.6.120/Filters.html | ||
* | ||
* @param {string} dimension Dimension to which filter is applied | ||
* @param {*} values Values to match | ||
*/ | ||
module.exports = function(dimension, values) { | ||
if (!dimension || typeof values === 'undefined') { | ||
throw new FieldError('Dimension or value is not specified') | ||
} | ||
|
||
// convert to empty string, null/empty string are the same thing to druid | ||
if (values === null) { | ||
values = [] | ||
} | ||
|
||
this.dimension = dimension | ||
this.values = values | ||
} |
This file contains 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