query-operator | R Documentation |
Operator are functions of maximum two arguments. The first argument is interpreted as a field (e.g. column name), the second one as a filtering value interpreted by operator accordingly. Some operators, such as 'is_empty' (that compares field values to empty string) don't require any value provided.
queryOperator(method)
setQueryOperators(..., .queryBuilderConfig = queryBuilderConfig)
listQueryOperators(.queryBuilderConfig = queryBuilderConfig, print = TRUE)
default_operators
method |
R function the operator should be transformed to when parsing result to R expression.
The function should take at most two parameters. The first one (obligatory) is variable vector,
the second one additional parameters interpreted by operator.
Could be negated with exclamation mark e.g. |
... |
Name-value pairs defining operator name and method respectively.
Should be defined with usage of |
.queryBuilderConfig |
R6 class object storing query configuration. See queryBuilderConfigClass. |
print |
Should the list of operators be printed into console? |
An object of class list
of length 20.
Operators are stored as quotes, that are further interpreted while converting the query to filtering expression.
queryOperator
: defines a custom operator that can be used in generated query.
setQueryOperators
:
is used to register the defined operators in the default or custom queryBuilderConfigClass object.
listQueryOperators
: allows to list available operators for the specific column type.
default_operators
: an object storing default definitions for operators.
A single 'quote' storing the provided method.
listQueryOperators()
in_closed_range <- function(x, range) {
x >= range[1] & x <= range[2]
}
setQueryOperators(
"within" = queryOperator(in_closed_range),
"not_within" = queryOperator(!in_closed_range)
)
query <- queryGroup(
condition = "AND",
queryRule("am", "equal", 1),
queryRule("qsec", "within", c(10, 15)),
queryRule("disp", "not_within", c(10, 15))
)
queryToExpr(query)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.