mongory 2.1.0-aarch64-linux → 2.2.0-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +55 -73
  4. data/docs/clang_bridge.md +2 -2
  5. data/docs/performance.md +43 -7
  6. data/lib/core/2.6/mongory_ext.so +0 -0
  7. data/lib/core/2.7/mongory_ext.so +0 -0
  8. data/lib/core/3.0/mongory_ext.so +0 -0
  9. data/lib/core/3.1/mongory_ext.so +0 -0
  10. data/lib/core/3.2/mongory_ext.so +0 -0
  11. data/lib/core/3.3/mongory_ext.so +0 -0
  12. data/lib/core/3.4/mongory_ext.so +0 -0
  13. data/lib/core/4.0/mongory_ext.so +0 -0
  14. data/lib/mongory/converters/abstract_converter.rb +5 -5
  15. data/lib/mongory/converters/converted.rb +0 -4
  16. data/lib/mongory/converters/key_converter.rb +13 -36
  17. data/lib/mongory/converters/value_converter.rb +4 -4
  18. data/lib/mongory/matchers.rb +8 -7
  19. data/lib/mongory/query_builder.rb +9 -0
  20. data/lib/mongory/utils/context.rb +0 -6
  21. data/lib/mongory/utils/singleton_builder.rb +1 -4
  22. data/lib/mongory/version.rb +1 -1
  23. data/lib/mongory.rb +0 -1
  24. data/mongory.gemspec +13 -12
  25. data/script/bench.rb +77 -4
  26. data/script/coverage.rb +84 -0
  27. metadata +9 -54
  28. data/ext/mongory_ext/extconf.rb +0 -115
  29. data/ext/mongory_ext/mongory-core/include/mongory-core/adapters/json.h +0 -62
  30. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/array.h +0 -122
  31. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/config.h +0 -217
  32. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/error.h +0 -82
  33. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/memory_pool.h +0 -115
  34. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/table.h +0 -127
  35. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/value.h +0 -175
  36. data/ext/mongory_ext/mongory-core/include/mongory-core/matchers/matcher.h +0 -103
  37. data/ext/mongory_ext/mongory-core/include/mongory-core.h +0 -12
  38. data/ext/mongory_ext/mongory-core/src/foundations/array.c +0 -336
  39. data/ext/mongory_ext/mongory-core/src/foundations/array_private.h +0 -20
  40. data/ext/mongory_ext/mongory-core/src/foundations/config.c +0 -335
  41. data/ext/mongory_ext/mongory-core/src/foundations/config_private.h +0 -49
  42. data/ext/mongory_ext/mongory-core/src/foundations/error.c +0 -48
  43. data/ext/mongory_ext/mongory-core/src/foundations/memory_pool.c +0 -406
  44. data/ext/mongory_ext/mongory-core/src/foundations/memory_pool_private.h +0 -45
  45. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.c +0 -117
  46. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.h +0 -43
  47. data/ext/mongory_ext/mongory-core/src/foundations/table.c +0 -502
  48. data/ext/mongory_ext/mongory-core/src/foundations/utils.c +0 -206
  49. data/ext/mongory_ext/mongory-core/src/foundations/utils.h +0 -77
  50. data/ext/mongory_ext/mongory-core/src/foundations/value.c +0 -548
  51. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.c +0 -193
  52. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.h +0 -117
  53. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.c +0 -241
  54. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.h +0 -83
  55. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.c +0 -730
  56. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.h +0 -131
  57. data/ext/mongory_ext/mongory-core/src/matchers/existence_matcher.c +0 -158
  58. data/ext/mongory_ext/mongory-core/src/matchers/existence_matcher.h +0 -48
  59. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.c +0 -199
  60. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.h +0 -58
  61. data/ext/mongory_ext/mongory-core/src/matchers/implicit_array_matcher.c +0 -204
  62. data/ext/mongory_ext/mongory-core/src/matchers/implicit_array_matcher.h +0 -47
  63. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.c +0 -124
  64. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.h +0 -46
  65. data/ext/mongory_ext/mongory-core/src/matchers/matcher.c +0 -529
  66. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.c +0 -117
  67. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.h +0 -29
  68. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.c +0 -61
  69. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.h +0 -23
  70. data/ext/mongory_ext/mongory-core/src/matchers/value_matcher.c +0 -416
  71. data/ext/mongory_ext/mongory-core/src/matchers/value_matcher.h +0 -97
  72. data/ext/mongory_ext/mongory_ext.c +0 -66
  73. data/ext/mongory_ext/mongory_ext_internal.h +0 -74
  74. data/ext/mongory_ext/rb_mongory_adapters.c +0 -140
  75. data/ext/mongory_ext/rb_mongory_matcher.c +0 -440
  76. data/ext/mongory_ext/rb_mongory_value.c +0 -327
@@ -1,204 +0,0 @@
1
- /**
2
- * @file implicit_array_matcher.c
3
- * @brief Implements a versatile matcher for arrays, handling various condition
4
- * types. This is an internal implementation file for the matcher module.
5
- *
6
- * This matcher can interpret conditions as:
7
- * - A table: Parsed for operators like $elemMatch or implicit field conditions
8
- * on array elements.
9
- * - A regex: Creates an $elemMatch to match array elements against the regex.
10
- * - A literal: Creates an $elemMatch to check for equality with elements.
11
- * - Another array: Checks for whole-array equality.
12
- * It often constructs a composite OR matcher to combine these possibilities.
13
- */
14
- #include "implicit_array_matcher.h"
15
- #include "../foundations/config_private.h"
16
- #include "../foundations/utils.h" // For mongory_try_parse_int
17
- #include "base_matcher.h" // For mongory_matcher_base_new
18
- #include "compare_matcher.h" // For mongory_matcher_equal_new
19
- #include "composite_matcher.h" // For mongory_matcher_composite_new, $elemMatch, table_cond_new, or_match
20
- #include "value_matcher.h" // Potentially used by table_cond_new
21
- #include "mongory-core/foundations/table.h"
22
- #include "mongory-core/foundations/value.h"
23
- #include <mongory-core.h> // General include
24
- #include <stdio.h> // For NULL
25
- #include <string.h> // For strcmp
26
-
27
- /**
28
- * @struct mongory_matcher_implicit_array_parse_table_context
29
- * @brief Context used when parsing a table condition for array record matching.
30
- *
31
- * Helps separate parts of the condition table:
32
- * - `parsed_table`: For explicit operators (e.g., $size, $all if implemented)
33
- * or indexed conditions.
34
- * - `elem_match_table`: For conditions that should apply to individual elements
35
- * via an implicit or explicit $elemMatch.
36
- */
37
- typedef struct mongory_matcher_implicit_array_parse_table_context {
38
- mongory_table *parsed_table; /**< Stores operator or indexed conditions. */
39
- mongory_table *elem_match_table; /**< Stores conditions for element matching. */
40
- } mongory_matcher_implicit_array_parse_table_context;
41
-
42
- /**
43
- * @brief Callback to parse a condition table for array matching.
44
- *
45
- * Iterates through the main condition table:
46
- * - If `key` is "$elemMatch" and `value` is a table, its contents are added to
47
- * `context->elem_match_table`.
48
- * - If `key` is an element-level comparison operator (`$gt`, `$gte`, `$lt`,
49
- * `$lte`, `$regex` with its `$options`, or non-array `$eq`), it's added to
50
- * `context->elem_match_table`.
51
- * - If `key` starts with '$' (container operator like `$size`, `$in`, `$nin`,
52
- * `$every`, `$ne`, or array `$eq`) or is a valid integer index, it's added to
53
- * `context->parsed_table`.
54
- * - Otherwise (plain field name), it's considered part of an implicit element
55
- * match and added to `context->elem_match_table`.
56
- *
57
- * @param key Current key in the condition table.
58
- * @param value Current value for the key.
59
- * @param acc Pointer to `mongory_matcher_implicit_array_parse_table_context`.
60
- * @return Always true to continue.
61
- */
62
- static inline bool mongory_is_elem_match_operator(char *key, mongory_value *value) {
63
- if (strcmp(key, "$gt") == 0 || strcmp(key, "$gte") == 0 ||
64
- strcmp(key, "$lt") == 0 || strcmp(key, "$lte") == 0 ||
65
- strcmp(key, "$regex") == 0 || strcmp(key, "$options") == 0) {
66
- return true;
67
- }
68
- if (strcmp(key, "$eq") == 0) {
69
- return value == NULL || value->type != MONGORY_TYPE_ARRAY;
70
- }
71
- return false;
72
- }
73
-
74
- static inline bool mongory_matcher_implicit_array_parse_table_foreach(char *key, mongory_value *value, void *acc) {
75
- mongory_matcher_implicit_array_parse_table_context *context = (mongory_matcher_implicit_array_parse_table_context *)acc;
76
- mongory_table *parsed_table_for_operators = context->parsed_table;
77
- mongory_table *table_for_elem_match_conditions = context->elem_match_table;
78
-
79
- if (strcmp(key, "$elemMatch") == 0 && value->type == MONGORY_TYPE_TABLE && value->data.t != NULL) {
80
- // Explicit $elemMatch: iterate its sub-table and add to elem_match_table
81
- mongory_table_merge(table_for_elem_match_conditions, value->data.t);
82
- } else if (mongory_is_elem_match_operator(key, value)) {
83
- // Element-level comparison operators apply to array elements via $elemMatch
84
- table_for_elem_match_conditions->set(table_for_elem_match_conditions, key, value);
85
- } else if (*key == '$' || mongory_try_parse_int(key, NULL)) {
86
- // Array-level operator (like $size, $in, $nin, $every, $ne) or numeric index: goes to parsed_table
87
- parsed_table_for_operators->set(parsed_table_for_operators, key, value);
88
- } else {
89
- // Regular field name: implies a condition on elements, goes to
90
- // elem_match_table
91
- table_for_elem_match_conditions->set(table_for_elem_match_conditions, key, value);
92
- }
93
- return true;
94
- }
95
-
96
- /**
97
- * @brief Parses a table `condition` intended for array matching.
98
- *
99
- * Separates the condition into parts for direct array operations (like $size)
100
- * and parts for matching individual elements (implicit or explicit $elemMatch).
101
- * If any element-matching conditions are found, they are grouped under an
102
- * "$elemMatch" key in the returned `parsed_table`.
103
- *
104
- * @param condition The `mongory_value` (must be a table) to parse.
105
- * @return A new `mongory_value` (table) containing the parsed and restructured
106
- * condition. Returns NULL if input is not a table or on allocation failure.
107
- */
108
- static inline mongory_value *mongory_matcher_implicit_array_parse_table(mongory_memory_pool *pool, mongory_value *condition) {
109
- if (!pool) {
110
- return NULL;
111
- }
112
- if (!condition || !condition->data.t) {
113
- mongory_error_set(pool, MONGORY_ERROR_INVALID_TYPE, "Expected condition to be a table, got a non-table value");
114
- return NULL; // Invalid input
115
- }
116
- mongory_table *parsed_table = mongory_table_new(pool);
117
- mongory_table *elem_match_sub_table = mongory_table_new(pool);
118
-
119
- if (!parsed_table || !elem_match_sub_table) {
120
- return NULL;
121
- }
122
-
123
- mongory_matcher_implicit_array_parse_table_context parse_ctx = {parsed_table, elem_match_sub_table};
124
- mongory_table *original_condition_table = condition->data.t;
125
-
126
- original_condition_table->each(original_condition_table, &parse_ctx,
127
- mongory_matcher_implicit_array_parse_table_foreach);
128
- if (pool->error != NULL) {
129
- return NULL;
130
- }
131
-
132
- if (elem_match_sub_table->count > 0) {
133
- // If there were conditions for element matching, add them as an $elemMatch
134
- // clause to the main parsed_table.
135
- mongory_value *wrapped_elem = mongory_value_wrap_t(pool, elem_match_sub_table);
136
- if (!wrapped_elem || !parsed_table->set(parsed_table, "$elemMatch", wrapped_elem)) {
137
- return NULL;
138
- }
139
- }
140
- // If elem_match_sub_table is empty, it's not added. The original parsed_table
141
- // (which might contain $size etc.) is returned.
142
- return mongory_value_wrap_t(pool, parsed_table);
143
- }
144
-
145
- /**
146
- * @brief Main constructor for `mongory_matcher_implicit_array_new`.
147
- *
148
- * Constructs a two-part matcher (often combined with OR):
149
- * - `left`: Handles element-wise conditions (like $elemMatch from various
150
- * condition types).
151
- * - `right`: Handles whole-array equality if the original `condition` was an
152
- * array.
153
- *
154
- * If `right` is NULL (i.e., original `condition` was not an array), only the
155
- * `left` matcher is returned. Otherwise, a composite OR matcher is created
156
- * with `left` and `right` as children.
157
- *
158
- * @param pool Memory pool.
159
- * @param condition The condition to apply to arrays.
160
- * @return The constructed implicit_array_matcher, or NULL on failure.
161
- */
162
- mongory_matcher *mongory_matcher_implicit_array_new(mongory_memory_pool *pool, mongory_value *condition, void *extern_ctx) {
163
- if (!condition || !pool)
164
- return NULL;
165
- mongory_compile_budget saved = mongory_compile_budget_begin();
166
- mongory_matcher *result = NULL;
167
- switch (condition->type) {
168
- case MONGORY_TYPE_TABLE: {
169
- mongory_value *parsed = mongory_matcher_implicit_array_parse_table(pool, condition);
170
- if (parsed && pool->error == NULL) {
171
- result = mongory_matcher_condition_new(pool, parsed, extern_ctx);
172
- }
173
- break;
174
- }
175
- case MONGORY_TYPE_ARRAY: {
176
- mongory_value *or_cond = MG_ARRAY_WRAP(pool, 2,
177
- MG_TABLE_WRAP(pool, 1, "$eq", condition),
178
- MG_TABLE_WRAP(pool, 1, "$elemMatch",
179
- MG_TABLE_WRAP(pool, 1, "$eq", condition)
180
- )
181
- );
182
- if (or_cond && pool->error == NULL) {
183
- result = mongory_matcher_or_new(pool, or_cond, extern_ctx);
184
- }
185
- break;
186
- }
187
- case MONGORY_TYPE_REGEX: {
188
- mongory_value *re_cond = MG_TABLE_WRAP(pool, 1, "$regex", condition);
189
- if (re_cond && pool->error == NULL) {
190
- result = mongory_matcher_elem_match_new(pool, re_cond, extern_ctx);
191
- }
192
- break;
193
- }
194
- default: { // Literals (string, int, bool, etc.)
195
- mongory_value *eq_cond = MG_TABLE_WRAP(pool, 1, "$eq", condition);
196
- if (eq_cond && pool->error == NULL) {
197
- result = mongory_matcher_elem_match_new(pool, eq_cond, extern_ctx);
198
- }
199
- break;
200
- }
201
- }
202
- mongory_compile_budget_end(saved);
203
- return result;
204
- }
@@ -1,47 +0,0 @@
1
- #ifndef MONGORY_MATCHER_IMPLICIT_ARRAY_H
2
- #define MONGORY_MATCHER_IMPLICIT_ARRAY_H
3
-
4
- /**
5
- * @file implicit_array_matcher.h
6
- * @brief Defines the constructor for a matcher that handles complex conditions
7
- * against arrays. This is an internal header for the matcher module.
8
- *
9
- * This matcher is more specialized than simple `$elemMatch` or `$every`. It can
10
- * interpret a condition that might be a direct value to find, a regex to match
11
- * elements, or a table defining multiple criteria for array elements (similar
12
- * to an implicit `$elemMatch` with that table). It can also handle checking if
13
- * an input array is equal to a condition array.
14
- */
15
-
16
- #include "base_matcher.h"
17
- #include "mongory-core/foundations/memory_pool.h"
18
- #include "mongory-core/foundations/value.h"
19
- #include "mongory-core/matchers/matcher.h" // For mongory_matcher structure
20
-
21
- /**
22
- * @brief Creates an "array record" matcher.
23
- *
24
- * This matcher is designed to apply various types of conditions to an input
25
- * array or its elements. The behavior depends on the `condition`'s type:
26
- * - If `condition` is a table: It's parsed. Keys like `$elemMatch` are handled
27
- * specifically. Other field-value pairs in the table are typically wrapped
28
- * into an implicit `$elemMatch` condition that applies to elements of the
29
- * target array.
30
- * - If `condition` is a regex: It effectively creates an `$elemMatch` where
31
- * each element of the target array is matched against this regex.
32
- * - If `condition` is a simple literal (string, number, bool): It creates an
33
- * `$elemMatch` where elements are checked for equality against this literal.
34
- * - If `condition` itself is an array: It creates a matcher that checks if the
35
- * target array is equal to this condition array.
36
- *
37
- * The resulting matcher might be a composite of several internal matchers (e.g.,
38
- * an OR between element matching and whole-array equality).
39
- *
40
- * @param pool Memory pool for allocation.
41
- * @param condition A `mongory_value` representing the condition to apply to an
42
- * array or its elements.
43
- * @return A new array record matcher, or NULL on failure.
44
- */
45
- mongory_matcher *mongory_matcher_implicit_array_new(mongory_memory_pool *pool, mongory_value *condition, void *extern_ctx);
46
-
47
- #endif /* MONGORY_MATCHER_IMPLICIT_ARRAY_H */
@@ -1,124 +0,0 @@
1
- /**
2
- * @file inclusion_matcher.c
3
- * @brief Implements $in and $nin matchers for checking value inclusion in an
4
- * array. This is an internal implementation file for the matcher module.
5
- */
6
- #include "inclusion_matcher.h"
7
- #include "base_matcher.h" // For mongory_matcher_base_new
8
- #include "../foundations/array_private.h" // For mongory_array_includes
9
- #include "mongory-core/foundations/array.h" // For mongory_array operations
10
- #include "mongory-core/foundations/error.h" // For mongory_error
11
- #include "mongory-core/foundations/value.h" // For mongory_value
12
- #include <mongory-core.h> // General include
13
- #include "../foundations/utils.h" // For mongory_string_cpy
14
-
15
- /**
16
- * @brief Validates that the condition for an inclusion matcher is a valid
17
- * array.
18
- * @param condition The `mongory_value` condition to validate.
19
- * @return True if `condition` is not NULL, is of type `MONGORY_TYPE_ARRAY`,
20
- * and its internal array data `condition->data.a` is not NULL. False otherwise.
21
- */
22
- static inline bool mongory_matcher_validate_array_condition(mongory_value *condition) {
23
- if (condition == NULL) {
24
- return false; // Condition must exist.
25
- }
26
- if (condition->type != MONGORY_TYPE_ARRAY) {
27
- return false; // Condition must be an array.
28
- }
29
- if (condition->data.a == NULL) {
30
- return false; // The array data within the condition must be valid.
31
- }
32
- return true;
33
- }
34
-
35
- /**
36
- * @brief Match function for the $in matcher.
37
- *
38
- * If `value_to_check` is a scalar, it checks if `value_to_check` is present in
39
- * `matcher->condition` (which must be an array).
40
- * If `value_to_check` is an array, it checks if any element of `value_to_check`
41
- * is present in `matcher->condition` (array intersection).
42
- *
43
- * @param matcher The $in matcher instance.
44
- * @param value_to_check The value to check for inclusion.
45
- * @return True if `value_to_check` (or one of its elements) is found in the
46
- * condition array, false otherwise.
47
- */
48
- static inline bool mongory_matcher_in_match(mongory_matcher *matcher, mongory_value *value_to_check) {
49
- if (!value_to_check || !matcher->condition || !matcher->condition->data.a) {
50
- // Invalid inputs or condition is not a proper array.
51
- return false;
52
- }
53
-
54
- mongory_array *condition_array = matcher->condition->data.a;
55
-
56
- if (value_to_check->type != MONGORY_TYPE_ARRAY) {
57
- return mongory_array_includes(condition_array, value_to_check);
58
- }
59
-
60
- mongory_array *input_array = value_to_check->data.a;
61
- if (!input_array) {
62
- return false;
63
- }
64
-
65
- for (size_t i = 0; i < input_array->count; i++) {
66
- mongory_value *input_item = input_array->get(input_array, i);
67
- if (mongory_array_includes(condition_array, input_item)) {
68
- return true;
69
- }
70
- }
71
-
72
- return false;
73
- }
74
-
75
- mongory_matcher *mongory_matcher_in_new(mongory_memory_pool *pool, mongory_value *condition, void *extern_ctx) {
76
- if (!mongory_matcher_validate_array_condition(condition)) {
77
- mongory_error_set(pool, MONGORY_ERROR_INVALID_ARGUMENT, "$in condition must be a valid array.");
78
- return NULL;
79
- }
80
- mongory_matcher *matcher = mongory_matcher_base_new(pool, condition, extern_ctx);
81
- if (!matcher) {
82
- return NULL;
83
- }
84
- matcher->match = mongory_matcher_in_match;
85
- matcher->original_match = mongory_matcher_in_match;
86
- matcher->name = mongory_string_cpy(pool, "In");
87
- if (!matcher->name) {
88
- return NULL;
89
- }
90
- matcher->priority = 1.0 + mongory_log((double)condition->data.a->count + 1.0, 1.5);
91
- return matcher;
92
- }
93
-
94
- /**
95
- * @brief Match function for the $nin (not in) matcher.
96
- * Simply negates the result of the $in logic.
97
- * @param matcher The $nin matcher instance.
98
- * @param value The value to check.
99
- * @return True if the value is NOT found according to $in logic, false
100
- * otherwise.
101
- */
102
- static inline bool mongory_matcher_not_in_match(mongory_matcher *matcher, mongory_value *value) {
103
- // $nin is true if $in is false.
104
- return !mongory_matcher_in_match(matcher, value);
105
- }
106
-
107
- mongory_matcher *mongory_matcher_not_in_new(mongory_memory_pool *pool, mongory_value *condition, void *extern_ctx) {
108
- if (!mongory_matcher_validate_array_condition(condition)) {
109
- mongory_error_set(pool, MONGORY_ERROR_INVALID_ARGUMENT, "$nin condition must be a valid array.");
110
- return NULL;
111
- }
112
- mongory_matcher *matcher = mongory_matcher_base_new(pool, condition, extern_ctx);
113
- if (!matcher) {
114
- return NULL;
115
- }
116
- matcher->match = mongory_matcher_not_in_match;
117
- matcher->original_match = mongory_matcher_not_in_match;
118
- matcher->name = mongory_string_cpy(pool, "Nin");
119
- if (!matcher->name) {
120
- return NULL;
121
- }
122
- matcher->priority = 1.0 + mongory_log((double)condition->data.a->count + 1.0, 1.5);
123
- return matcher;
124
- }
@@ -1,46 +0,0 @@
1
- #ifndef MONGORY_MATCHER_INCLUSION_H
2
- #define MONGORY_MATCHER_INCLUSION_H
3
-
4
- /**
5
- * @file inclusion_matcher.h
6
- * @brief Defines constructors for inclusion matchers ($in, $nin).
7
- * This is an internal header for the matcher module.
8
- *
9
- * These matchers check if a value is present or not present in a given array
10
- * of values.
11
- */
12
-
13
- #include "base_matcher.h"
14
- #include "mongory-core/foundations/memory_pool.h"
15
- #include "mongory-core/foundations/value.h"
16
- #include "mongory-core/matchers/matcher.h" // For mongory_matcher structure
17
-
18
- /**
19
- * @brief Creates an "in" ($in) matcher.
20
- *
21
- * Matches if the input value is equal to any of the values in the `condition`
22
- * array. If the input value itself is an array, it matches if any element of
23
- * the input array is found in the `condition` array (set intersection).
24
- *
25
- * @param pool Memory pool for allocation.
26
- * @param condition A `mongory_value` of type `MONGORY_TYPE_ARRAY` containing
27
- * the set of values to check against.
28
- * @return A new `$in` matcher, or NULL on failure or invalid condition.
29
- */
30
- mongory_matcher *mongory_matcher_in_new(mongory_memory_pool *pool, mongory_value *condition, void *extern_ctx);
31
-
32
- /**
33
- * @brief Creates a "not in" ($nin) matcher.
34
- *
35
- * Matches if the input value is not equal to any of the values in the
36
- * `condition` array. If the input value itself is an array, it matches if no
37
- * element of the input array is found in the `condition` array.
38
- *
39
- * @param pool Memory pool for allocation.
40
- * @param condition A `mongory_value` of type `MONGORY_TYPE_ARRAY` containing
41
- * the set of values to check against.
42
- * @return A new `$nin` matcher, or NULL on failure or invalid condition.
43
- */
44
- mongory_matcher *mongory_matcher_not_in_new(mongory_memory_pool *pool, mongory_value *condition, void *extern_ctx);
45
-
46
- #endif /* MONGORY_MATCHER_INCLUSION_H */