Expression filters are applied on each applicable server record. Expression filters require server version >= 5.2.0.4.
If the filter exists and evaluates to false in a single record command, the command is ignored and AEROSPIKE_FILTERED_OUT is returned as an error code.
If the filter exists and evaluates to false in a batch record row, AEROSPIKE_FILTERED_OUT is returned as a status for that record row in the batch.
If the filter exists and evaluates to false on a scan/query record, that record is not returned.
Expression filters can now be defined on all commands through the command policy (as_policy_base contained in as_policy_read, as_policy_write, ...).
Example:
as_exp_build(filter,
as_policy_read_init(&p);
p.filter_exp = filter;
...
as_exp_destroy(filter);
#define as_exp_bin_int(__bin_name)
#define as_exp_int(__val)
|
#define | as_exp_bin_blob(__bin_name) |
|
#define | as_exp_bin_bool(__bin_name) |
|
#define | as_exp_bin_float(__bin_name) |
|
#define | as_exp_bin_geo(__bin_name) |
|
#define | as_exp_bin_int(__bin_name) |
|
#define | as_exp_bin_str(__bin_name) |
|
#define | as_exp_bool(__val) {.op=_AS_EXP_CODE_VAL_BOOL, .v.bool_val=__val} |
|
#define | as_exp_bytes(__val, __size) {.op=_AS_EXP_CODE_VAL_BYTES, .sz=__size, .v.bytes_val=__val} |
|
#define | as_exp_float(__val) {.op=_AS_EXP_CODE_VAL_FLOAT, .v.float_val=__val} |
|
#define | as_exp_geo(__val) {.op=_AS_EXP_CODE_VAL_GEO, .v.val=(as_val*)as_geojson_new(__val, false)} |
|
#define | as_exp_inf() as_exp_val(&as_cmp_inf) |
|
#define | as_exp_int(__val) {.op=_AS_EXP_CODE_VAL_INT, .v.int_val=__val} |
|
#define | as_exp_key_blob() |
|
#define | as_exp_key_exist() {.op=_AS_EXP_CODE_KEY_EXIST, .count=1} |
|
#define | as_exp_key_int() |
|
#define | as_exp_key_str() |
|
#define | as_exp_nil() as_exp_val(&as_nil) |
|
#define | as_exp_str(__val) {.op=_AS_EXP_CODE_VAL_STR, .v.str_val=__val} |
|
#define | as_exp_uint(__val) {.op=_AS_EXP_CODE_VAL_UINT, .v.uint_val=__val} |
|
#define | as_exp_unknown() {.op=_AS_EXP_CODE_UNKNOWN, .count=1} |
|
#define | as_exp_val(__val) {.op=_AS_EXP_CODE_AS_VAL, .v.val=(as_val*)(__val)} |
|
#define | as_exp_wildcard() as_exp_val(&as_cmp_wildcard) |
|
◆ as_exp_bin_blob
#define as_exp_bin_blob |
( |
| __bin_name | ) |
|
Value: {.op=_AS_EXP_CODE_BIN, .count=3}, \
_AS_EXP_VAL_RAWSTR(__bin_name)
Create expression that returns a bin as a blob. Returns 'unknown' if the bin is not an blob.
uint8_t val[] = {0x65, 0x65}
as_exp_build(expression,
#define as_exp_bin_blob(__bin_name)
#define as_exp_bytes(__val, __size)
- Parameters
-
- Returns
- (blob bin)
Definition at line 537 of file as_exp.h.
◆ as_exp_bin_bool
#define as_exp_bin_bool |
( |
| __bin_name | ) |
|
Value: {.op=_AS_EXP_CODE_BIN, .count=3}, \
_AS_EXP_VAL_RAWSTR(__bin_name)
Create expression that returns a bin as a boolean value. Returns 'unknown' if the bin is not a boolean.
#define as_exp_bin_bool(__bin_name)
- Parameters
-
- Returns
- (boolean bin)
Definition at line 460 of file as_exp.h.
◆ as_exp_bin_float
#define as_exp_bin_float |
( |
| __bin_name | ) |
|
Value: {.op=_AS_EXP_CODE_BIN, .count=3}, \
_AS_EXP_VAL_RAWSTR(__bin_name)
Create expression that returns a bin as a float. Returns 'unknown' if the bin is not an float.
as_exp_build(expression,
#define as_exp_float(__val)
- Parameters
-
- Returns
- (float bin)
Definition at line 498 of file as_exp.h.
◆ as_exp_bin_geo
#define as_exp_bin_geo |
( |
| __bin_name | ) |
|
Value: {.op=_AS_EXP_CODE_BIN, .count=3}, \
_AS_EXP_VAL_RAWSTR(__bin_name)
Create expression that returns a bin as a geojson. Returns 'unknown' if the bin is not geojson.
as_exp_build(expression,
#define as_exp_bin_geo(__bin_name)
- Parameters
-
- Returns
- (geojson bin)
Definition at line 556 of file as_exp.h.
◆ as_exp_bin_int
#define as_exp_bin_int |
( |
| __bin_name | ) |
|
Value: {.op=_AS_EXP_CODE_BIN, .count=3}, \
_AS_EXP_VAL_RAWSTR(__bin_name)
Create expression that returns a bin as a signed integer. Returns 'unknown' if the bin is not an integer.
- Parameters
-
- Returns
- (integer bin)
Definition at line 479 of file as_exp.h.
◆ as_exp_bin_str
#define as_exp_bin_str |
( |
| __bin_name | ) |
|
Value: {.op=_AS_EXP_CODE_BIN, .count=3}, \
_AS_EXP_VAL_RAWSTR(__bin_name)
Create expression that returns a bin as a string. Returns 'unknown' if the bin is not an string.
as_exp_build(expression,
#define as_exp_str(__val)
#define as_exp_bin_str(__bin_name)
- Parameters
-
- Returns
- (string bin)
Definition at line 517 of file as_exp.h.
◆ as_exp_bool
#define as_exp_bool |
( |
| __val | ) |
{.op=_AS_EXP_CODE_VAL_BOOL, .v.bool_val=__val} |
Create boolean value.
- Parameters
-
Definition at line 296 of file as_exp.h.
◆ as_exp_bytes
#define as_exp_bytes |
( |
| __val, |
|
|
| __size ) {.op=_AS_EXP_CODE_VAL_BYTES, .sz=__size, .v.bytes_val=__val} |
Create byte array value.
- Parameters
-
__val | byte array value. |
__size | number of bytes. |
Definition at line 337 of file as_exp.h.
◆ as_exp_float
#define as_exp_float |
( |
| __val | ) |
{.op=_AS_EXP_CODE_VAL_FLOAT, .v.float_val=__val} |
Create 64 bit floating point value.
- Parameters
-
__val | floating point value. |
Definition at line 320 of file as_exp.h.
◆ as_exp_geo
#define as_exp_geo |
( |
| __val | ) |
{.op=_AS_EXP_CODE_VAL_GEO, .v.val=(as_val*)as_geojson_new(__val, false)} |
Create geojson value.
- Parameters
-
Definition at line 345 of file as_exp.h.
◆ as_exp_inf
Create infinity value.
Definition at line 365 of file as_exp.h.
◆ as_exp_int
#define as_exp_int |
( |
| __val | ) |
{.op=_AS_EXP_CODE_VAL_INT, .v.int_val=__val} |
Create 64 bit signed integer value.
- Parameters
-
Definition at line 304 of file as_exp.h.
◆ as_exp_key_blob
#define as_exp_key_blob |
( |
| ) |
|
Value: {.op=_AS_EXP_CODE_KEY, .count=2}, \
Create expression that returns the key as an blob. Returns 'unknown' if the key is not an blob.
uint8_t val[] = {0x65, 0x65}
as_exp_build(expression,
#define as_exp_key_blob()
- Returns
- (blob value) Blob value of the key if the key is a blob.
Definition at line 423 of file as_exp.h.
◆ as_exp_key_exist
#define as_exp_key_exist |
( |
| ) |
{.op=_AS_EXP_CODE_KEY_EXIST, .count=1} |
Create expression that returns if the primary key is stored in the record meta data as a boolean expression. This would occur when "as_policy_write.key" is AS_POLICY_KEY_SEND on record write.
as_exp_build(expression, as_exp_key_exists());
- Returns
- (boolean value) True if the record has a stored key, false otherwise.
Definition at line 439 of file as_exp.h.
◆ as_exp_key_int
#define as_exp_key_int |
( |
| ) |
|
Value: {.op=_AS_EXP_CODE_KEY, .count=2}, \
Create expression that returns the key as an integer. Returns 'unknown' if the key is not an integer.
- Returns
- (integer value) Integer value of the key if the key is an integer.
Definition at line 390 of file as_exp.h.
◆ as_exp_key_str
#define as_exp_key_str |
( |
| ) |
|
Value: {.op=_AS_EXP_CODE_KEY, .count=2}, \
Create expression that returns the key as an string. Returns 'unknown' if the key is not a string.
- Returns
- (string value) String value of the key if the key is a string.
Definition at line 406 of file as_exp.h.
◆ as_exp_nil
Create 'nil' value.
Definition at line 359 of file as_exp.h.
◆ as_exp_str
#define as_exp_str |
( |
| __val | ) |
{.op=_AS_EXP_CODE_VAL_STR, .v.str_val=__val} |
Create string value.
- Parameters
-
Definition at line 328 of file as_exp.h.
◆ as_exp_uint
#define as_exp_uint |
( |
| __val | ) |
{.op=_AS_EXP_CODE_VAL_UINT, .v.uint_val=__val} |
Create 64 bit unsigned integer value.
- Parameters
-
__val | unsigned integer value. |
Definition at line 312 of file as_exp.h.
◆ as_exp_unknown
#define as_exp_unknown |
( |
| ) |
{.op=_AS_EXP_CODE_UNKNOWN, .count=1} |
Create an 'unknown' value. Used to intentionally fail an expression. The failure can be ignored with AS_EXP_WRITE_EVAL_NO_FAIL or AS_EXP_READ_NO_FAIL. Requires server version 5.6.0+.
as_exp_build(expression,
as_exp_let(
as_exp_def("v", as_exp_sub(
as_exp_cond(
as_exp_ge(as_exp_var(
"v"),
as_exp_float(0)), as_exp_var(
"v"),
#define as_exp_bin_float(__bin_name)
- Returns
- (unknown value)
Definition at line 288 of file as_exp.h.
◆ as_exp_val
#define as_exp_val |
( |
| __val | ) |
{.op=_AS_EXP_CODE_AS_VAL, .v.val=(as_val*)(__val)} |
◆ as_exp_wildcard
Create wildcard value.
Definition at line 371 of file as_exp.h.
◆ as_exp_destroy()
◆ as_exp_destroy_base64()
static void as_exp_destroy_base64 |
( |
char * | base64 | ) |
|
|
inlinestatic |
◆ as_exp_from_base64()
Decode null-terminated base64 string to expression. Call as_exp_destroy() when done with expression.
◆ as_exp_to_base64()
static char * as_exp_to_base64 |
( |
as_exp * | exp | ) |
|
|
inlinestatic |