Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
aerospike
as_predexp.h
Go to the documentation of this file.
1
/*
2
* Copyright 2016-2017 Aerospike, Inc.
3
*
4
* Portions may be licensed to Aerospike, Inc. under one or more contributor
5
* license agreements.
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
8
* use this file except in compliance with the License. You may obtain a copy of
9
* the License at http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
* License for the specific language governing permissions and limitations under
15
* the License.
16
*/
17
#pragma once
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
23
struct
as_predexp_base_s;
24
25
typedef
void (*
as_predexp_base_dtor_fn
) (
struct
as_predexp_base_s *);
26
typedef
size_t (*
as_predexp_base_size_fn
) (
struct
as_predexp_base_s *);
27
typedef
uint8_t * (*as_predexp_base_write_fn) (
struct
as_predexp_base_s *, uint8_t *p);
28
29
/**
30
* Defines a predicate expression base.
31
*/
32
typedef
struct
as_predexp_base_s {
33
34
/**
35
* Destructor for this object.
36
*/
37
as_predexp_base_dtor_fn
dtor_fn
;
38
39
/**
40
* Returns serialization size of this object.
41
*/
42
as_predexp_base_size_fn
size_fn
;
43
44
/**
45
* Serialize this object into a command.
46
*/
47
as_predexp_base_write_fn
write_fn
;
48
49
}
as_predexp_base
;
50
51
/**
52
* Create an AND logical predicate expression.
53
*
54
* The AND predicate expression returns true if all of its children
55
* are true.
56
*
57
* The nexpr parameter specifies how many children to pop off the
58
* expression stack. These children must be "logical" expressions
59
* and not "value" expressions.
60
*
61
* For example, the following sequence of predicate expressions
62
* selects records where the value of bin "c" is between 11 and 20
63
* inclusive:
64
*
65
* ~~~~~~~~~~{.c}
66
* as_query_predexp_inita(&q, 7);
67
* as_query_predexp_add(&q, as_predexp_integer_bin("c"));
68
* as_query_predexp_add(&q, as_predexp_integer_value(11));
69
* as_query_predexp_add(&q, as_predexp_integer_greatereq());
70
* as_query_predexp_add(&q, as_predexp_integer_bin("c"));
71
* as_query_predexp_add(&q, as_predexp_integer_value(20));
72
* as_query_predexp_add(&q, as_predexp_integer_lesseq());
73
* as_query_predexp_add(&q, as_predexp_and(2));
74
* ~~~~~~~~~~
75
*
76
* @param nexpr The number of child expressions to AND.
77
*
78
* @returns a predicate expression suitable for adding to a query or
79
* scan.
80
*/
81
as_predexp_base
*
82
as_predexp_and
(uint16_t nexpr);
83
84
/**
85
* Create an OR logical predicate expression.
86
*
87
* The OR predicate expression returns true if any of its children
88
* are true.
89
*
90
* The nexpr parameter specifies how many children to pop off the
91
* expression stack. These children must be "logical" expressions
92
* and not "value" expressions.
93
*
94
* For example, the following sequence of predicate expressions
95
* selects records where the value of bin "pet" is "cat" or "dog".
96
*
97
* ~~~~~~~~~~{.c}
98
* as_query_predexp_inita(&q, 7);
99
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
100
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
101
* as_query_predexp_add(&q, as_predexp_string_equal());
102
* as_query_predexp_add(&q, as_predexp_string_value("dog"));
103
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
104
* as_query_predexp_add(&q, as_predexp_string_equal());
105
* as_query_predexp_add(&q, as_predexp_or(2));
106
* ~~~~~~~~~~
107
*
108
* @param nexpr The number of child expressions to OR.
109
*
110
* @returns a predicate expression suitable for adding to a query or
111
* scan.
112
*/
113
as_predexp_base
*
114
as_predexp_or
(uint16_t nexpr);
115
116
/**
117
* Create a NOT logical predicate expression.
118
*
119
* The NOT predicate expression returns true if its child is false.
120
*
121
* The NOT expression pops a single child off the expression stack.
122
* This child must be a "logical" expression and not a "value"
123
* expression.
124
*
125
* For example, the following sequence of predicate expressions
126
* selects records where the value of bin "pet" is not "dog".
127
*
128
* ~~~~~~~~~~{.c}
129
* as_query_predexp_inita(&q, 4);
130
* as_query_predexp_add(&q, as_predexp_string_value("dog"));
131
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
132
* as_query_predexp_add(&q, as_predexp_string_equal());
133
* as_query_predexp_add(&q, as_predexp_not());
134
* ~~~~~~~~~~
135
*
136
* @returns a predicate expression suitable for adding to a query or
137
* scan.
138
*/
139
as_predexp_base
*
140
as_predexp_not
();
141
142
/**
143
* Create a constant integer value predicate expression.
144
*
145
* The integer value predicate expression pushes a single constant
146
* integer value onto the expression stack.
147
*
148
* For example, the following sequence of predicate expressions
149
* selects records where the value of bin "c" is between 11 and 20
150
* inclusive:
151
*
152
* ~~~~~~~~~~{.c}
153
* as_query_predexp_inita(&q, 7);
154
* as_query_predexp_add(&q, as_predexp_integer_bin("c"));
155
* as_query_predexp_add(&q, as_predexp_integer_value(11));
156
* as_query_predexp_add(&q, as_predexp_integer_greatereq());
157
* as_query_predexp_add(&q, as_predexp_integer_bin("c"));
158
* as_query_predexp_add(&q, as_predexp_integer_value(20));
159
* as_query_predexp_add(&q, as_predexp_integer_lesseq());
160
* as_query_predexp_add(&q, as_predexp_and(2));
161
* ~~~~~~~~~~
162
*
163
* @param value The integer value.
164
*
165
* @returns a predicate expression suitable for adding to a query or
166
* scan.
167
*/
168
as_predexp_base
*
169
as_predexp_integer_value
(int64_t value);
170
171
/**
172
* Create a constant string value predicate expression.
173
*
174
* The string value predicate expression pushes a single constant
175
* string value onto the expression stack.
176
*
177
* For example, the following sequence of predicate expressions
178
* selects records where the value of bin "pet" is "cat" or "dog":
179
*
180
* ~~~~~~~~~~{.c}
181
* as_query_predexp_inita(&q, 7);
182
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
183
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
184
* as_query_predexp_add(&q, as_predexp_string_equal());
185
* as_query_predexp_add(&q, as_predexp_string_value("dog"));
186
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
187
* as_query_predexp_add(&q, as_predexp_string_equal());
188
* as_query_predexp_add(&q, as_predexp_or(2));
189
* ~~~~~~~~~~
190
*
191
* @param value The string value.
192
*
193
* @returns a predicate expression suitable for adding to a query or
194
* scan.
195
*/
196
as_predexp_base
*
197
as_predexp_string_value
(
char
const
* value);
198
199
/**
200
* Create a constant GeoJSON value predicate expression.
201
*
202
* The GeoJSON value predicate expression pushes a single constant
203
* GeoJSON value onto the expression stack.
204
*
205
* For example, the following sequence of predicate expressions
206
* selects records where a point in bin "loc" is inside the
207
* specified polygon:
208
*
209
* ~~~~~~~~~~{.c}
210
* char const * region =
211
* "{ "
212
* " \"type\": \"Polygon\", "
213
* " \"coordinates\": [ "
214
* " [[-122.500000, 37.000000],[-121.000000, 37.000000], "
215
* " [-121.000000, 38.080000],[-122.500000, 38.080000], "
216
* " [-122.500000, 37.000000]] "
217
* " ] "
218
* " } ";
219
*
220
* as_query_predexp_inita(&query, 3);
221
* as_query_predexp_add(&query, as_predexp_geojson_bin("loc"));
222
* as_query_predexp_add(&query, as_predexp_geojson_value(region));
223
* as_query_predexp_add(&query, as_predexp_geojson_within());
224
* ~~~~~~~~~~
225
*
226
* @param value The GeoJSON string value.
227
*
228
* @returns a predicate expression suitable for adding to a query or
229
* scan.
230
*/
231
as_predexp_base
*
232
as_predexp_geojson_value
(
char
const
* value);
233
234
/**
235
* Create an integer bin value predicate expression.
236
*
237
* The integer bin predicate expression pushes a single integer bin
238
* value extractor onto the expression stack.
239
*
240
* For example, the following sequence of predicate expressions
241
* selects records where the value of bin "c" is between 11 and 20
242
* inclusive:
243
*
244
* ~~~~~~~~~~{.c}
245
* as_query_predexp_inita(&q, 7);
246
* as_query_predexp_add(&q, as_predexp_integer_bin("c"));
247
* as_query_predexp_add(&q, as_predexp_integer_value(11));
248
* as_query_predexp_add(&q, as_predexp_integer_greatereq());
249
* as_query_predexp_add(&q, as_predexp_integer_bin("c"));
250
* as_query_predexp_add(&q, as_predexp_integer_value(20));
251
* as_query_predexp_add(&q, as_predexp_integer_lesseq());
252
* as_query_predexp_add(&q, as_predexp_and(2));
253
* ~~~~~~~~~~
254
*
255
* @param binname The name of the bin.
256
*
257
* @returns a predicate expression suitable for adding to a query or
258
* scan.
259
*/
260
as_predexp_base
*
261
as_predexp_integer_bin
(
char
const
* binname);
262
263
/**
264
* Create an string bin value predicate expression.
265
*
266
* The string bin predicate expression pushes a single string bin
267
* value extractor onto the expression stack.
268
*
269
* For example, the following sequence of predicate expressions
270
* selects records where the value of bin "pet" is "cat" or "dog":
271
*
272
* ~~~~~~~~~~{.c}
273
* as_query_predexp_inita(&q, 7);
274
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
275
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
276
* as_query_predexp_add(&q, as_predexp_string_equal());
277
* as_query_predexp_add(&q, as_predexp_string_value("dog"));
278
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
279
* as_query_predexp_add(&q, as_predexp_string_equal());
280
* as_query_predexp_add(&q, as_predexp_or(2));
281
* ~~~~~~~~~~
282
*
283
* @param binname The name of the bin.
284
*
285
* @returns a predicate expression suitable for adding to a query or
286
* scan.
287
*/
288
as_predexp_base
*
289
as_predexp_string_bin
(
char
const
* binname);
290
291
/**
292
* Create an GeoJSON bin value predicate expression.
293
*
294
* The GeoJSON bin predicate expression pushes a single GeoJSON bin
295
* value extractor onto the expression stack.
296
*
297
* For example, the following sequence of predicate expressions
298
* selects records where a point in bin "loc" is inside the
299
* specified polygon:
300
*
301
* ~~~~~~~~~~{.c}
302
* char const * region =
303
* "{ "
304
* " \"type\": \"Polygon\", "
305
* " \"coordinates\": [ "
306
* " [[-122.500000, 37.000000],[-121.000000, 37.000000], "
307
* " [-121.000000, 38.080000],[-122.500000, 38.080000], "
308
* " [-122.500000, 37.000000]] "
309
* " ] "
310
* " } ";
311
*
312
* as_query_predexp_inita(&query, 3);
313
* as_query_predexp_add(&query, as_predexp_geojson_bin("loc"));
314
* as_query_predexp_add(&query, as_predexp_geojson_value(region));
315
* as_query_predexp_add(&query, as_predexp_geojson_within());
316
* ~~~~~~~~~~
317
*
318
* @param binname The name of the bin.
319
*
320
* @returns a predicate expression suitable for adding to a query or
321
* scan.
322
*/
323
as_predexp_base
*
324
as_predexp_geojson_bin
(
char
const
* binname);
325
326
/**
327
* Create a list bin value predicate expression.
328
*
329
* The list bin predicate expression pushes a single list bin value
330
* extractor onto the expression stack. List bin values may be used
331
* with list iteration expressions to evaluate a subexpression for
332
* each of the elements of the list.
333
*
334
* For example, the following sequence of predicate expressions
335
* selects records where one of the list items is "cat":
336
*
337
* ~~~~~~~~~~{.c}
338
* as_query_predexp_inita(&q, 5);
339
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
340
* as_query_predexp_add(&q, as_predexp_string_var("item"));
341
* as_query_predexp_add(&q, as_predexp_string_equal());
342
* as_query_predexp_add(&q, as_predexp_list_bin("pets"));
343
* as_query_predexp_add(&q, as_predexp_list_iterate_or("item"));
344
* ~~~~~~~~~~
345
*
346
* @param binname The name of the bin.
347
*
348
* @returns a predicate expression suitable for adding to a query or
349
* scan.
350
*/
351
as_predexp_base
*
352
as_predexp_list_bin
(
char
const
* binname);
353
354
/**
355
* Create a map bin value predicate expression.
356
*
357
* The map bin predicate expression pushes a single map bin value
358
* extractor onto the expression stack. Map bin values may be used
359
* with map iteration expressions to evaluate a subexpression for
360
* each of the elements of the map.
361
*
362
* For example, the following sequence of predicate expressions
363
* selects records where the map contains a key of "cat":
364
*
365
* ~~~~~~~~~~{.c}
366
* as_query_predexp_inita(&q, 5);
367
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
368
* as_query_predexp_add(&q, as_predexp_string_var("key"));
369
* as_query_predexp_add(&q, as_predexp_string_equal());
370
* as_query_predexp_add(&q, as_predexp_map_bin("petcount"));
371
* as_query_predexp_add(&q, as_predexp_mapkey_iterate_or("key"));
372
* ~~~~~~~~~~
373
*
374
* @param binname The name of the bin.
375
*
376
* @returns a predicate expression suitable for adding to a query or
377
* scan.
378
*/
379
as_predexp_base
*
380
as_predexp_map_bin
(
char
const
* binname);
381
382
/**
383
* Create an integer iteration variable (value) predicate expression.
384
*
385
* The integer iteration variable is used in the subexpression child
386
* of a list or map iterator and takes the value of each element in
387
* the collection as it is traversed.
388
*
389
* For example, the following sequence of predicate expressions
390
* selects records where the list contains a value of 42:
391
*
392
* ~~~~~~~~~~{.c}
393
* as_query_predexp_inita(&q, 5);
394
* as_query_predexp_add(&q, as_predexp_integer_var("item"));
395
* as_query_predexp_add(&q, as_predexp_integer_value(42));
396
* as_query_predexp_add(&q, as_predexp_integer_equal());
397
* as_query_predexp_add(&q, as_predexp_list_bin("numbers"));
398
* as_query_predexp_add(&q, as_predexp_list_iterate_or("item"));
399
* ~~~~~~~~~~
400
*
401
* @param varname The name of the iteration variable.
402
*
403
* @returns a predicate expression suitable for adding to a query or
404
* scan.
405
*/
406
as_predexp_base
*
407
as_predexp_integer_var
(
char
const
* varname);
408
409
/**
410
* Create an string iteration variable (value) predicate expression.
411
*
412
* The string iteration variable is used in the subexpression child
413
* of a list or map iterator and takes the value of each element in
414
* the collection as it is traversed.
415
*
416
* For example, the following sequence of predicate expressions
417
* selects records where one of the list items is "cat":
418
*
419
* ~~~~~~~~~~{.c}
420
* as_query_predexp_inita(&q, 5);
421
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
422
* as_query_predexp_add(&q, as_predexp_string_var("item"));
423
* as_query_predexp_add(&q, as_predexp_string_equal());
424
* as_query_predexp_add(&q, as_predexp_list_bin("pets"));
425
* as_query_predexp_add(&q, as_predexp_list_iterate_or("item"));
426
* ~~~~~~~~~~
427
*
428
* @param varname The name of the iteration variable.
429
*
430
* @returns a predicate expression suitable for adding to a query or
431
* scan.
432
*/
433
as_predexp_base
*
434
as_predexp_string_var
(
char
const
* varname);
435
436
/**
437
* Create an GeoJSON iteration variable (value) predicate expression.
438
*
439
* The GeoJSON iteration variable is used in the subexpression child
440
* of a list or map iterator and takes the value of each element in
441
* the collection as it is traversed.
442
*
443
* @param varname The name of the iteration variable.
444
*
445
* @returns a predicate expression suitable for adding to a query or
446
* scan.
447
*/
448
as_predexp_base
*
449
as_predexp_geojson_var
(
char
const
* varname);
450
451
/**
452
* Create a record device size metadata value predicate expression.
453
*
454
* The record device size expression assumes the value of the size in
455
* bytes that the record occupies on device storage. For non-persisted
456
* records, this value is 0.
457
*
458
* For example, the following sequence of predicate expressions
459
* selects records whose device storage size is larger than 65K:
460
*
461
* ~~~~~~~~~~{.c}
462
* as_query_predexp_inita(&q, 3);
463
* as_query_predexp_add(&q, as_predexp_rec_device_size());
464
* as_query_predexp_add(&q, as_predexp_integer_value(65 * 1024));
465
* as_query_predexp_add(&q, as_predexp_integer_greater());
466
* ~~~~~~~~~~
467
*
468
* @returns a predicate expression suitable for adding to a query or
469
* scan.
470
*/
471
as_predexp_base
*
472
as_predexp_rec_device_size
();
473
474
/**
475
* Create a last update record metadata value predicate expression.
476
*
477
* The record last update expression assumes the value of the number
478
* of nanoseconds since the unix epoch that the record was last
479
* updated.
480
*
481
* For example, the following sequence of predicate expressions
482
* selects records that have been updated after an timestamp:
483
*
484
* ~~~~~~~~~~{.c}
485
* as_query_predexp_inita(&q, 3);
486
* as_query_predexp_add(&q, as_predexp_rec_last_update());
487
* as_query_predexp_add(&q, as_predexp_integer_value(g_tstampns));
488
* as_query_predexp_add(&q, as_predexp_integer_greater());
489
* ~~~~~~~~~~
490
*
491
* @returns a predicate expression suitable for adding to a query or
492
* scan.
493
*/
494
as_predexp_base
*
495
as_predexp_rec_last_update
();
496
497
/**
498
* Create a void time record metadata value predicate expression.
499
*
500
* The record void time expression assumes the value of the number of
501
* nanoseconds since the unix epoch when the record will expire. The
502
* special value of 0 means the record will not expire.
503
*
504
* For example, the following sequence of predicate expressions
505
* selects records that have void time set to 0 (no expiration):
506
*
507
* ~~~~~~~~~~{.c}
508
* as_query_predexp_inita(&q, 3);
509
* as_query_predexp_add(&q, as_predexp_rec_void_time());
510
* as_query_predexp_add(&q, as_predexp_integer_value(0));
511
* as_query_predexp_add(&q, as_predexp_integer_equal());
512
* ~~~~~~~~~~
513
*
514
* @returns a predicate expression suitable for adding to a query or
515
* scan.
516
*/
517
as_predexp_base
*
518
as_predexp_rec_void_time
();
519
520
/**
521
* Create a digest modulo record metadata value predicate expression.
522
*
523
* The digest modulo expression assumes the value of 4 bytes of the
524
* record's key digest modulo it's argument.
525
*
526
* For example, the following sequence of predicate expressions
527
* selects records that have digest(key) % 3 == 1):
528
*
529
* ~~~~~~~~~~{.c}
530
* as_query_predexp_inita(&q, 3);
531
* as_query_predexp_add(&q, as_predexp_rec_digest_modulo(3));
532
* as_query_predexp_add(&q, as_predexp_integer_value(1));
533
* as_query_predexp_add(&q, as_predexp_integer_equal());
534
* ~~~~~~~~~~
535
*
536
* @returns a predicate expression suitable for adding to a query or
537
* scan.
538
*/
539
as_predexp_base
*
540
as_predexp_rec_digest_modulo
();
541
542
/**
543
* Create an integer comparison logical predicate expression.
544
*
545
* The integer comparison expressions pop a pair of value expressions
546
* off the expression stack and compare them. The deeper of the two
547
* child expressions (pushed earlier) is considered the left side of
548
* the expression and the shallower (pushed later) is considered the
549
* right side.
550
*
551
* If the value of either of the child expressions is unknown because
552
* a specified bin does not exist or contains a value of the wrong
553
* type the result of the comparison is false. If a true outcome is
554
* desirable in this situation use the complimentary comparison and
555
* enclose in a logical NOT.
556
*
557
* For example, the following sequence of predicate expressions
558
* selects records that have bin "foo" greater than 42:
559
*
560
* ~~~~~~~~~~{.c}
561
* as_query_predexp_inita(&q, 3);
562
* as_query_predexp_add(&q, as_predexp_integer_bin("foo"));
563
* as_query_predexp_add(&q, as_predexp_integer_value(42));
564
* as_query_predexp_add(&q, as_predexp_integer_greater());
565
* ~~~~~~~~~~
566
*
567
* @returns a predicate expression suitable for adding to a query or
568
* scan.
569
*/
570
as_predexp_base
*
571
as_predexp_integer_equal
();
572
573
as_predexp_base
*
574
as_predexp_integer_unequal
();
575
576
as_predexp_base
*
577
as_predexp_integer_greater
();
578
579
as_predexp_base
*
580
as_predexp_integer_greatereq
();
581
582
as_predexp_base
*
583
as_predexp_integer_less
();
584
585
as_predexp_base
*
586
as_predexp_integer_lesseq
();
587
588
/**
589
* Create an string comparison logical predicate expression.
590
*
591
* The string comparison expressions pop a pair of value expressions
592
* off the expression stack and compare them. The deeper of the two
593
* child expressions (pushed earlier) is considered the left side of
594
* the expression and the shallower (pushed later) is considered the
595
* right side.
596
*
597
* If the value of either of the child expressions is unknown because
598
* a specified bin does not exist or contains a value of the wrong
599
* type the result of the comparison is false. If a true outcome is
600
* desirable in this situation use the complimentary comparison and
601
* enclose in a logical NOT.
602
*
603
* For example, the following sequence of predicate expressions
604
* selects records that have bin "pet" equal to "cat":
605
*
606
* ~~~~~~~~~~{.c}
607
* as_query_predexp_inita(&q, 3);
608
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
609
* as_query_predexp_add(&q, as_predexp_string_bin("pet"));
610
* as_query_predexp_add(&q, as_predexp_string_equal());
611
* ~~~~~~~~~~
612
*
613
* @returns a predicate expression suitable for adding to a query or
614
* scan.
615
*/
616
as_predexp_base
*
617
as_predexp_string_equal
();
618
619
as_predexp_base
*
620
as_predexp_string_unequal
();
621
622
/**
623
* Create an string regular expression logical predicate expression.
624
*
625
* The string regex expression pops two children off the expression
626
* stack and compares a child value expression to a regular
627
* expression. The left child (pushed earlier) must contain the
628
* string value to be matched. The right child (pushed later) must
629
* be a string value containing a valid regular expression..
630
*
631
* If the value of the left child is unknown because a specified
632
* bin does not exist or contains a value of the wrong type the
633
* result of the regex match is false.
634
*
635
* The cflags argument is passed to the regcomp library routine on
636
* the server. Useful values include REG_EXTENDED, REG_ICASE and
637
* REG_NEWLINE.
638
*
639
* For example, the following sequence of predicate expressions
640
* selects records that have bin "hex" value ending in '1' or '2':
641
*
642
* ~~~~~~~~~~{.c}
643
* as_query_predexp_inita(&q, 3);
644
* as_query_predexp_add(&q, as_predexp_string_bin("hex"));
645
* as_query_predexp_add(&q, as_predexp_string_value("0x00.[12]"));
646
* as_query_predexp_add(&q, as_predexp_string_regex(REG_ICASE));
647
* ~~~~~~~~~~
648
*
649
* @param cflags POSIX regex cflags value.
650
*
651
* @returns a predicate expression suitable for adding to a query or
652
* scan.
653
*/
654
as_predexp_base
*
655
as_predexp_string_regex
(uint32_t cflags);
656
657
/**
658
* Create an GeoJSON Points-in-Region logical predicate expression.
659
*
660
* The Points-in-Region (within) expression pops two children off the
661
* expression stack and checks to see if a child GeoJSON point is
662
* inside a specified GeoJSON region. The left child (pushed
663
* earlier) must contain a GeoJSON value specifying a point. The
664
* right child (pushed later) must be a GeoJSON value containing a
665
* region.
666
*
667
* If the value of the left child is unknown because a specified bin
668
* does not exist or contains a value of the wrong type the result of
669
* the within expression is false.
670
*
671
* For example, the following sequence of predicate expressions
672
* selects records where a point in bin "loc" is inside the
673
* specified polygon:
674
*
675
* ~~~~~~~~~~{.c}
676
* char const * region =
677
* "{ "
678
* " \"type\": \"Polygon\", "
679
* " \"coordinates\": [ "
680
* " [[-122.500000, 37.000000],[-121.000000, 37.000000], "
681
* " [-121.000000, 38.080000],[-122.500000, 38.080000], "
682
* " [-122.500000, 37.000000]] "
683
* " ] "
684
* " } ";
685
*
686
* as_query_predexp_inita(&query, 3);
687
* as_query_predexp_add(&query, as_predexp_geojson_bin("loc"));
688
* as_query_predexp_add(&query, as_predexp_geojson_value(region));
689
* as_query_predexp_add(&query, as_predexp_geojson_within());
690
* ~~~~~~~~~~
691
*
692
* @returns a predicate expression suitable for adding to a query or
693
* scan.
694
*/
695
as_predexp_base
*
696
as_predexp_geojson_within
();
697
698
/**
699
* Create an GeoJSON Regions-Containing-Point logical predicate expression.
700
*
701
* The Regions-Containing-Point (contains) expression pops two
702
* children off the expression stack and checks to see if a child
703
* GeoJSON region contains a specified GeoJSON point. The left child
704
* (pushed earlier) must contain a GeoJSON value specifying a
705
* possibly enclosing region. The right child (pushed later) must be
706
* a GeoJSON value containing a point.
707
*
708
* If the value of the left child is unknown because a specified bin
709
* does not exist or contains a value of the wrong type the result of
710
* the contains expression is false.
711
*
712
* For example, the following sequence of predicate expressions
713
* selects records where a region in bin "rgn" contains the specified
714
* query point:
715
*
716
* ~~~~~~~~~~{.c}
717
* char const * point =
718
* "{ "
719
* " \"type\": \"Point\", "
720
* " \"coordinates\": [ -122.0986857, 37.4214209 ] "
721
* "} ";
722
*
723
* as_query_predexp_inita(&query, 3);
724
* as_query_predexp_add(&query, as_predexp_geojson_bin("rgn"));
725
* as_query_predexp_add(&query, as_predexp_geojson_value(point));
726
* as_query_predexp_add(&query, as_predexp_geojson_contains());
727
* ~~~~~~~~~~
728
*
729
* @returns a predicate expression suitable for adding to a query or
730
* scan.
731
*/
732
as_predexp_base
*
733
as_predexp_geojson_contains
();
734
735
/**
736
* Create an list iteration OR logical predicate expression.
737
*
738
* The list iteration expression pops two children off the expression
739
* stack. The left child (pushed earlier) must contain a logical
740
* subexpression containing one or more matching iteration variable
741
* expressions. The right child (pushed later) must specify a list
742
* bin. The list iteration traverses the list and repeatedly
743
* evaluates the subexpression substituting each list element's value
744
* into the matching iteration variable. The result of the iteration
745
* expression is a logical OR of all of the individual element
746
* evaluations.
747
*
748
* If the list bin contains zero elements as_predexp_list_iterate_or
749
* will return false.
750
*
751
* For example, the following sequence of predicate expressions
752
* selects records where one of the list items is "cat":
753
*
754
* ~~~~~~~~~~{.c}
755
* as_query_predexp_inita(&q, 5);
756
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
757
* as_query_predexp_add(&q, as_predexp_string_var("item"));
758
* as_query_predexp_add(&q, as_predexp_string_equal());
759
* as_query_predexp_add(&q, as_predexp_list_bin("pets"));
760
* as_query_predexp_add(&q, as_predexp_list_iterate_or("item"));
761
* ~~~~~~~~~~
762
*
763
* @param varname The name of the list item iteration variable.
764
*
765
* @returns a predicate expression suitable for adding to a query or
766
* scan.
767
*/
768
as_predexp_base
*
769
as_predexp_list_iterate_or
(
char
const
* varname);
770
771
/**
772
* Create an list iteration AND logical predicate expression.
773
*
774
* The list iteration expression pops two children off the expression
775
* stack. The left child (pushed earlier) must contain a logical
776
* subexpression containing one or more matching iteration variable
777
* expressions. The right child (pushed later) must specify a list
778
* bin. The list iteration traverses the list and repeatedly
779
* evaluates the subexpression substituting each list element's value
780
* into the matching iteration variable. The result of the iteration
781
* expression is a logical AND of all of the individual element
782
* evaluations.
783
*
784
* If the list bin contains zero elements as_predexp_list_iterate_and
785
* will return true. This is useful when testing for exclusion (see
786
* example).
787
*
788
* For example, the following sequence of predicate expressions
789
* selects records where none of the list items is "cat":
790
*
791
* ~~~~~~~~~~{.c}
792
* as_query_predexp_inita(&q, 6);
793
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
794
* as_query_predexp_add(&q, as_predexp_string_var("item"));
795
* as_query_predexp_add(&q, as_predexp_string_equal());
796
* as_query_predexp_add(&q, as_predexp_not());
797
* as_query_predexp_add(&q, as_predexp_list_bin("pets"));
798
* as_query_predexp_add(&q, as_predexp_list_iterate_and("item"));
799
* ~~~~~~~~~~
800
*
801
* @param varname The name of the list item iteration variable.
802
*
803
* @returns a predicate expression suitable for adding to a query or
804
* scan.
805
*/
806
as_predexp_base
*
807
as_predexp_list_iterate_and
(
char
const
* varname);
808
809
/**
810
* Create an map key iteration OR logical predicate expression.
811
*
812
* The mapkey iteration expression pops two children off the
813
* expression stack. The left child (pushed earlier) must contain a
814
* logical subexpression containing one or more matching iteration
815
* variable expressions. The right child (pushed later) must specify
816
* a map bin. The mapkey iteration traverses the map and repeatedly
817
* evaluates the subexpression substituting each map key value into
818
* the matching iteration variable. The result of the iteration
819
* expression is a logical OR of all of the individual element
820
* evaluations.
821
*
822
* If the map bin contains zero elements as_predexp_mapkey_iterate_or
823
* will return false.
824
*
825
* For example, the following sequence of predicate expressions
826
* selects records where one of the map keys is "cat":
827
*
828
* ~~~~~~~~~~{.c}
829
* as_query_predexp_inita(&q, 5);
830
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
831
* as_query_predexp_add(&q, as_predexp_string_var("item"));
832
* as_query_predexp_add(&q, as_predexp_string_equal());
833
* as_query_predexp_add(&q, as_predexp_map_bin("petcount"));
834
* as_query_predexp_add(&q, as_predexp_mapkey_iterate_or("item"));
835
* ~~~~~~~~~~
836
*
837
* @param varname The name of the map key iteration variable.
838
*
839
* @returns a predicate expression suitable for adding to a query or
840
* scan.
841
*/
842
as_predexp_base
*
843
as_predexp_mapkey_iterate_or
(
char
const
* varname);
844
845
/**
846
* Create an map key iteration AND logical predicate expression.
847
*
848
* The mapkey iteration expression pops two children off the
849
* expression stack. The left child (pushed earlier) must contain a
850
* logical subexpression containing one or more matching iteration
851
* variable expressions. The right child (pushed later) must specify
852
* a map bin. The mapkey iteration traverses the map and repeatedly
853
* evaluates the subexpression substituting each map key value into
854
* the matching iteration variable. The result of the iteration
855
* expression is a logical AND of all of the individual element
856
* evaluations.
857
*
858
* If the map bin contains zero elements as_predexp_mapkey_iterate_and
859
* will return true. This is useful when testing for exclusion (see
860
* example).
861
*
862
* For example, the following sequence of predicate expressions
863
* selects records where none of the map keys is "cat":
864
*
865
* ~~~~~~~~~~{.c}
866
* as_query_predexp_inita(&q, 6);
867
* as_query_predexp_add(&q, as_predexp_string_value("cat"));
868
* as_query_predexp_add(&q, as_predexp_string_var("item"));
869
* as_query_predexp_add(&q, as_predexp_string_equal());
870
* as_query_predexp_add(&q, as_predexp_not());
871
* as_query_predexp_add(&q, as_predexp_map_bin("petcount"));
872
* as_query_predexp_add(&q, as_predexp_mapkey_iterate_or("item"));
873
* ~~~~~~~~~~
874
*
875
* @param varname The name of the map key iteration variable.
876
*
877
* @returns a predicate expression suitable for adding to a query or
878
* scan.
879
*/
880
as_predexp_base
*
881
as_predexp_mapkey_iterate_and
(
char
const
* varname);
882
883
/**
884
* Create an map value iteration OR logical predicate expression.
885
*
886
* The mapval iteration expression pops two children off the
887
* expression stack. The left child (pushed earlier) must contain a
888
* logical subexpression containing one or more matching iteration
889
* variable expressions. The right child (pushed later) must specify
890
* a map bin. The mapval iteration traverses the map and repeatedly
891
* evaluates the subexpression substituting each map value into the
892
* matching iteration variable. The result of the iteration
893
* expression is a logical OR of all of the individual element
894
* evaluations.
895
*
896
* If the map bin contains zero elements as_predexp_mapval_iterate_or
897
* will return false.
898
*
899
* For example, the following sequence of predicate expressions
900
* selects records where one of the map values is 0:
901
*
902
* ~~~~~~~~~~{.c}
903
* as_query_predexp_inita(&q, 5);
904
* as_query_predexp_add(&q, as_predexp_integer_var("count"));
905
* as_query_predexp_add(&q, as_predexp_integer_value(0));
906
* as_query_predexp_add(&q, as_predexp_integer_equal());
907
* as_query_predexp_add(&q, as_predexp_map_bin("petcount"));
908
* as_query_predexp_add(&q, as_predexp_mapval_iterate_or("count"));
909
* ~~~~~~~~~~
910
*
911
* @param varname The name of the map value iteration variable.
912
*
913
* @returns a predicate expression suitable for adding to a query or
914
* scan.
915
*/
916
as_predexp_base
*
917
as_predexp_mapval_iterate_or
(
char
const
* varname);
918
919
/**
920
* Create an map value iteration AND logical predicate expression.
921
*
922
* The mapval iteration expression pops two children off the
923
* expression stack. The left child (pushed earlier) must contain a
924
* logical subexpression containing one or more matching iteration
925
* variable expressions. The right child (pushed later) must specify
926
* a map bin. The mapval iteration traverses the map and repeatedly
927
* evaluates the subexpression substituting each map value into the
928
* matching iteration variable. The result of the iteration
929
* expression is a logical AND of all of the individual element
930
* evaluations.
931
*
932
* If the map bin contains zero elements as_predexp_mapval_iterate_and
933
* will return true. This is useful when testing for exclusion (see
934
* example).
935
*
936
* For example, the following sequence of predicate expressions
937
* selects records where none of the map values is 0:
938
*
939
* ~~~~~~~~~~{.c}
940
* as_query_predexp_inita(&q, 6);
941
* as_query_predexp_add(&q, as_predexp_integer_var("count"));
942
* as_query_predexp_add(&q, as_predexp_integer_value(0));
943
* as_query_predexp_add(&q, as_predexp_integer_equal());
944
* as_query_predexp_add(&q, as_predexp_not());
945
* as_query_predexp_add(&q, as_predexp_map_bin("petcount"));
946
* as_query_predexp_add(&q, as_predexp_mapval_iterate_and("count"));
947
* ~~~~~~~~~~
948
*
949
* @param varname The name of the map value iteration variable.
950
*
951
* @returns a predicate expression suitable for adding to a query or
952
* scan.
953
*/
954
as_predexp_base
*
955
as_predexp_mapval_iterate_and
(
char
const
* varname);
956
957
#ifdef __cplusplus
958
}
// end extern "C"
959
#endif