library(queryBuilder)
The article describes default set of operators offered by
queryBuilder
. Each operator generates expression that can
be use to perform various filtering operations.
listQueryOperators()
#> equal: ==
#> not_equal: !=
#> in: %in%
#> not_in: !`%in%`
#> less: <
#> less_or_equal: <=
#> greater: >
#> greater_or_equal: >=
#> between: queryBuilder::in_range
#> not_between: !queryBuilder::in_range
#> begins_with: startsWith
#> not_begins_with: !startsWith
#> contains: queryBuilder::in_string
#> not_contains: !queryBuilder::in_string
#> ends_with: endsWith
#> not_ends_with: !endsWith
#> is_empty: queryBuilder::is_empty
#> not_is_empty: !queryBuilder::is_empty
#> is_null: is.na
#> not_is_null: !is.na
equal - check if field elements equal the provided value
==
.queryRule(field = "cyl", operator = "equal", value = 1)
cyl == 4
value
is required, should be a single
value.not_equal - check if field elements are different from the provided value
!=
.queryRule(field = "cyl", operator = "not_equal", value = 1)
cyl != 4
value
is required, should be a single
value.in - check if field elements matches the provided set of values
`%in%`
.queryRule(field = "cyl", operator = "in", value = c(4, 6))
cyl %in% c(4, 6)
value
is required, should be a non-empty
vector.not_in - check if field elements do not match the provided set of values
!`%in%`
.queryRule(field = "cyl", operator = "not_in", value = c(4, 6))
!cyl
%in% c(4, 6)
value
is required, should be a non-empty
vector.is_null - check if field elements are missing
(NA
)
is.na
.queryRule(field = "cyl", operator = "is_null")
is.na(cyl)
value
is ignored.not_is_null - check if field elements are different from the provided value
!is.na
.queryRule(field = "cyl", operator = "not_is_null")
!is.na(cyl)
value
is ignored.less - check if field elements are lesser than the provided value
<
.queryRule(field = "cyl", operator = "less", value = 6)
cyl < 6
value
is required, should be a single
value.less_or_equal - check if field elements are lesser or equal the provided value
<=
.queryRule(field = "cyl", operator = "less_or_equal", value = 6)
cyl <= 6
value
is required, should be a single
value.greater - check if field elements are greater than the provided value
>
.queryRule(field = "cyl", operator = "greater", value = 6)
cyl > 6
value
is required, should be a single
value.greater_or_equal - check if field elements are greater or equal the provided value
>=
.queryRule(field = "cyl", operator = "greater_or_equal", value = 6)
cyl >= 6
value
is required, should be a single
value.between - check if field elements fit within the provided range (boundary excluded)
queryBuilder::in_range
.queryRule(field = "cyl", operator = "between", value = c(4, 8))
queryBuilder::in_range(cyl, c(4,
8))
value
is required, should be a non-empty
vector.not_between - check if field elements do not match the provided set of values (boundary included)
!queryBuilder::in_range
.queryRule(field = "cyl", operator = "not_between", value = c(4, 8))
!queryBuilder::in_range(cyl, c(4,
8))
value
is required, should be a non-empty
vector.begins_with - check if field elements start with the provided string value
startsWith
.queryRule(field = "Species", operator = "begins_with", value = "setos")
startsWith(Species,
"setos")
value
is required, should be a single
character value.not_begins_with - check if field elements do not start with the provided string value
!startsWith
.queryRule(field = "Species", operator = "not_begins_with", value = "setos")
!startsWith(Species,
"setos")
value
is required, should be a single
value.contains - check if field elements start with the provided string value
queryBuilder::in_string
.queryRule(field = "Species", operator = "contains", value = "setos")
queryBuilder::in_string(Species,
"setos")
value
is required, should be a single
character value.not_contains - check if field elements do not start with the provided string value
!queryBuilder::in_string
.queryRule(field = "Species", operator = "not_contains", value = "etos")
!queryBuilder::in_string(Species,
"etos")
value
is required, should be a single
value.ends_with - check if field elements end with the provided string value
endsWith
.queryRule(field = "Species", operator = "ends_with", value = "etosa")
endsWith(Species,
"etosa")
value
is required, should be a single
character value.not_ends_with - check if field elements do not end with the provided string value
!startsWith
.queryRule(field = "Species", operator = "not_ends_with", value = "setos")
!endsWith(Species,
"etosa")
value
is required, should be a single
value.is_empty - check if field elements are an empty string
queryBuilder::is_empty
.queryRule(field = "Species", operator = "is_empty")
queryBuilder::is_empty(cyl)
value
is ignored.not_is_empty - check if field elements are not an empty string
!queryBuilder::is_empty
.queryRule(field = "Species", operator = "not_is_empty")
!queryBuilder::is_empty(cyl)
value
is ignored.In order to set custom operators please check
setQueryOperators()
.