gqlite 1.5.0 → 1.7.0

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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/ext/Cargo.toml +12 -6
  3. data/ext/db-index/Cargo.toml +29 -0
  4. data/ext/db-index/src/hnsw/error.rs +66 -0
  5. data/ext/db-index/src/hnsw/graph_store.rs +272 -0
  6. data/ext/db-index/src/hnsw/id.rs +36 -0
  7. data/ext/db-index/src/hnsw/implementation.rs +1517 -0
  8. data/ext/db-index/src/hnsw/kernels.rs +1228 -0
  9. data/ext/db-index/src/hnsw/metric.rs +244 -0
  10. data/ext/db-index/src/hnsw/scalar.rs +72 -0
  11. data/ext/db-index/src/hnsw/simple_store.rs +140 -0
  12. data/ext/db-index/src/hnsw/store.rs +472 -0
  13. data/ext/db-index/src/hnsw/vector.rs +105 -0
  14. data/ext/db-index/src/hnsw/vectors.rs +568 -0
  15. data/ext/db-index/src/hnsw.rs +42 -0
  16. data/ext/db-index/src/lib.rs +3 -0
  17. data/ext/gqlitedb/Cargo.toml +19 -8
  18. data/ext/gqlitedb/benches/common/pokec.rs +62 -2
  19. data/ext/gqlitedb/benches/pokec_divan.rs +66 -2
  20. data/ext/gqlitedb/benches/pokec_iai.rs +60 -3
  21. data/ext/gqlitedb/release.toml +2 -2
  22. data/ext/gqlitedb/src/aggregators/arithmetic.rs +3 -1
  23. data/ext/gqlitedb/src/aggregators/containers.rs +1 -1
  24. data/ext/gqlitedb/src/aggregators/stats.rs +21 -12
  25. data/ext/gqlitedb/src/capi.rs +20 -24
  26. data/ext/gqlitedb/src/compiler/expression_analyser.rs +28 -20
  27. data/ext/gqlitedb/src/compiler/variables_manager.rs +104 -38
  28. data/ext/gqlitedb/src/compiler.rs +506 -227
  29. data/ext/gqlitedb/src/connection.rs +151 -11
  30. data/ext/gqlitedb/src/consts.rs +1 -2
  31. data/ext/gqlitedb/src/error.rs +123 -61
  32. data/ext/gqlitedb/src/functions/common.rs +64 -0
  33. data/ext/gqlitedb/src/functions/containers.rs +2 -46
  34. data/ext/gqlitedb/src/functions/edge.rs +1 -1
  35. data/ext/gqlitedb/src/functions/math.rs +87 -15
  36. data/ext/gqlitedb/src/functions/node.rs +1 -1
  37. data/ext/gqlitedb/src/functions/path.rs +48 -11
  38. data/ext/gqlitedb/src/functions/scalar.rs +47 -4
  39. data/ext/gqlitedb/src/functions/string.rs +123 -1
  40. data/ext/gqlitedb/src/functions/value.rs +1 -1
  41. data/ext/gqlitedb/src/functions.rs +165 -28
  42. data/ext/gqlitedb/src/graph.rs +1 -9
  43. data/ext/gqlitedb/src/interpreter/evaluators.rs +968 -130
  44. data/ext/gqlitedb/src/interpreter/instructions.rs +39 -2
  45. data/ext/gqlitedb/src/lib.rs +5 -4
  46. data/ext/gqlitedb/src/parser/gql.pest +1 -1
  47. data/ext/gqlitedb/src/planner.rs +329 -0
  48. data/ext/gqlitedb/src/prelude.rs +3 -3
  49. data/ext/gqlitedb/src/store/pgrx.rs +1 -1
  50. data/ext/gqlitedb/src/store/postgres.rs +742 -16
  51. data/ext/gqlitedb/src/store/redb/hnsw_store.rs +702 -0
  52. data/ext/gqlitedb/src/store/redb/index.rs +274 -0
  53. data/ext/gqlitedb/src/store/redb.rs +1268 -113
  54. data/ext/gqlitedb/src/store/sqlbase/sqlmetadata.rs +28 -0
  55. data/ext/gqlitedb/src/store/sqlbase/sqlstore.rs +103 -0
  56. data/ext/gqlitedb/src/store/sqlbase.rs +146 -16
  57. data/ext/gqlitedb/src/store/sqlite.rs +576 -14
  58. data/ext/gqlitedb/src/store/vector_extract.rs +56 -0
  59. data/ext/gqlitedb/src/store.rs +140 -29
  60. data/ext/gqlitedb/src/tests/compiler.rs +207 -10
  61. data/ext/gqlitedb/src/tests/connection/postgres.rs +38 -3
  62. data/ext/gqlitedb/src/tests/connection/redb.rs +23 -0
  63. data/ext/gqlitedb/src/tests/connection/sqlite.rs +31 -0
  64. data/ext/gqlitedb/src/tests/connection.rs +61 -1
  65. data/ext/gqlitedb/src/tests/evaluators.rs +162 -7
  66. data/ext/gqlitedb/src/tests/parser.rs +54 -23
  67. data/ext/gqlitedb/src/tests/planner.rs +511 -0
  68. data/ext/gqlitedb/src/tests/store/postgres.rs +7 -0
  69. data/ext/gqlitedb/src/tests/store/redb.rs +8 -0
  70. data/ext/gqlitedb/src/tests/store/sqlite.rs +8 -0
  71. data/ext/gqlitedb/src/tests/store/vector_index/postgres.rs +182 -0
  72. data/ext/gqlitedb/src/tests/store/vector_index/redb.rs +386 -0
  73. data/ext/gqlitedb/src/tests/store/vector_index/sqlite.rs +166 -0
  74. data/ext/gqlitedb/src/tests/store/vector_index.rs +2313 -0
  75. data/ext/gqlitedb/src/tests/store.rs +78 -14
  76. data/ext/gqlitedb/src/tests/templates/ast.rs +92 -16
  77. data/ext/gqlitedb/src/tests/templates/programs.rs +14 -7
  78. data/ext/gqlitedb/src/tests.rs +15 -9
  79. data/ext/gqlitedb/src/utils.rs +6 -1
  80. data/ext/gqlitedb/src/value/compare.rs +61 -3
  81. data/ext/gqlitedb/src/value.rs +136 -7
  82. data/ext/gqlitedb/templates/sql/postgres/metadata_delete.sql +1 -0
  83. data/ext/gqlitedb/templates/sql/postgres/node_select.sql +1 -1
  84. data/ext/gqlitedb/templates/sql/sqlite/metadata_delete.sql +1 -0
  85. data/ext/gqliterb/src/lib.rs +53 -8
  86. data/ext/gqlparser/Cargo.toml +25 -0
  87. data/ext/gqlparser/README.MD +9 -0
  88. data/ext/gqlparser/benches/pokec_divan.rs +34 -0
  89. data/ext/gqlparser/src/common.rs +69 -0
  90. data/ext/gqlparser/src/gqls/ast.rs +69 -0
  91. data/ext/gqlparser/src/gqls/constraint.rs +79 -0
  92. data/ext/gqlparser/src/gqls/error.rs +22 -0
  93. data/ext/gqlparser/src/gqls/parser.rs +813 -0
  94. data/ext/gqlparser/src/gqls/prelude.rs +8 -0
  95. data/ext/gqlparser/src/gqls/properties.rs +115 -0
  96. data/ext/gqlparser/src/gqls/resolve.rs +207 -0
  97. data/ext/gqlparser/src/gqls.rs +265 -0
  98. data/ext/gqlparser/src/lib.rs +7 -0
  99. data/ext/gqlparser/src/oc/ast.rs +680 -0
  100. data/ext/gqlparser/src/oc/error.rs +172 -0
  101. data/ext/gqlparser/src/oc/lexer.rs +429 -0
  102. data/ext/gqlparser/src/oc/parser/tests.rs +2284 -0
  103. data/ext/gqlparser/src/oc/parser.rs +2005 -0
  104. data/ext/gqlparser/src/oc.rs +33 -0
  105. data/ext/gqlparser/src/prelude.rs +3 -0
  106. data/ext/graphcore/Cargo.toml +1 -0
  107. data/ext/graphcore/src/error.rs +26 -0
  108. data/ext/graphcore/src/graph.rs +177 -51
  109. data/ext/graphcore/src/lib.rs +4 -2
  110. data/ext/graphcore/src/open_cypher.rs +12 -0
  111. data/ext/graphcore/src/table.rs +50 -2
  112. data/ext/graphcore/src/timestamp.rs +127 -104
  113. data/ext/graphcore/src/value/tensor.rs +739 -0
  114. data/ext/graphcore/src/value/value_map.rs +1 -1
  115. data/ext/graphcore/src/value.rs +343 -19
  116. metadata +93 -28
  117. data/ext/gqlitedb/src/parser/ast.rs +0 -604
  118. data/ext/gqlitedb/src/parser/parser_impl.rs +0 -1213
  119. data/ext/gqlitedb/src/parser.rs +0 -4
@@ -1,604 +0,0 @@
1
- use std::{
2
- cell::RefCell,
3
- collections::{hash_map::Entry, HashMap},
4
- sync::atomic::AtomicU64,
5
- };
6
-
7
- use crate::graph;
8
-
9
- /// Represent a variable name. Some variable are explicitly created by the parser, if a node/edge should be considered equal and appear in different expression.
10
- /// For instance `()-[]->()-[]->()` needs the creation of a variable.
11
- #[derive(Debug, Clone, Eq)]
12
- pub(crate) struct VariableIdentifier
13
- {
14
- /// Name of the variable, only useful for debug purposes
15
- name: String,
16
- /// Unique identifier of the variable, the uniqueness is only guaranteed within a compilation unit.
17
- id: u64,
18
- }
19
-
20
- impl VariableIdentifier
21
- {
22
- pub(crate) fn name(&self) -> &String
23
- {
24
- &self.name
25
- }
26
- pub(crate) fn take_name(self) -> String
27
- {
28
- self.name
29
- }
30
- }
31
-
32
- impl PartialEq for VariableIdentifier
33
- {
34
- fn eq(&self, other: &Self) -> bool
35
- {
36
- self.id == other.id
37
- }
38
- }
39
-
40
- impl std::hash::Hash for VariableIdentifier
41
- {
42
- fn hash<H: std::hash::Hasher>(&self, state: &mut H)
43
- {
44
- self.id.hash(state);
45
- }
46
- }
47
-
48
- #[derive(Default)]
49
- pub(crate) struct VariableIdentifiers
50
- {
51
- next_id: AtomicU64,
52
- identifiers: RefCell<HashMap<String, VariableIdentifier>>,
53
- }
54
-
55
- impl VariableIdentifiers
56
- {
57
- fn next_id(&self) -> u64
58
- {
59
- self
60
- .next_id
61
- .fetch_add(1, std::sync::atomic::Ordering::Relaxed)
62
- }
63
- pub(crate) fn create_variable_from_name(&self, name: impl Into<String>) -> VariableIdentifier
64
- {
65
- let name = name.into();
66
- match self.identifiers.borrow_mut().entry(name)
67
- {
68
- Entry::Occupied(entry) => entry.get().clone(),
69
- Entry::Vacant(entry) =>
70
- {
71
- let vn = VariableIdentifier {
72
- name: entry.key().clone(),
73
- id: self.next_id(),
74
- };
75
- entry.insert(vn.clone());
76
- vn
77
- }
78
- }
79
- }
80
- pub(crate) fn create_variable_from_name_optional(
81
- &self,
82
- name: Option<String>,
83
- ) -> Option<VariableIdentifier>
84
- {
85
- name.map(|name| self.create_variable_from_name(name))
86
- }
87
- pub(crate) fn create_anonymous_variable(&self) -> VariableIdentifier
88
- {
89
- let id = self.next_id();
90
- VariableIdentifier {
91
- name: format!("anonymous_{}", id),
92
- id,
93
- }
94
- }
95
- }
96
-
97
- #[derive(Debug)]
98
- pub(crate) enum Statement
99
- {
100
- CreateGraph(CreateGraph),
101
- DropGraph(DropGraph),
102
- UseGraph(UseGraph),
103
- Create(Create),
104
- Match(Match),
105
- Return(Return),
106
- Call(Call),
107
- With(With),
108
- Unwind(Unwind),
109
- Delete(Delete),
110
- Update(Update),
111
- }
112
-
113
- macro_rules! create_from_statement {
114
- ( $x:tt ) => {
115
- impl From<$x> for Statement
116
- {
117
- fn from(v: $x) -> Statement
118
- {
119
- Statement::$x(v)
120
- }
121
- }
122
- };
123
- }
124
-
125
- pub(crate) type Statements = Vec<Statement>;
126
- pub(crate) type Queries = Vec<Statements>;
127
-
128
- #[derive(Debug)]
129
- pub(crate) struct CreateGraph
130
- {
131
- pub(crate) name: String,
132
- pub(crate) if_not_exists: bool,
133
- }
134
-
135
- #[derive(Debug)]
136
- pub(crate) struct DropGraph
137
- {
138
- pub(crate) name: String,
139
- pub(crate) if_exists: bool,
140
- }
141
-
142
- #[derive(Debug)]
143
- pub(crate) struct UseGraph
144
- {
145
- pub(crate) name: String,
146
- }
147
-
148
- #[derive(Debug)]
149
- pub(crate) struct Create
150
- {
151
- pub(crate) patterns: Vec<Pattern>,
152
- }
153
-
154
- create_from_statement! {Create}
155
-
156
- #[derive(Debug)]
157
- pub(crate) struct Match
158
- {
159
- pub(crate) patterns: Vec<Pattern>,
160
- pub(crate) where_expression: Option<Expression>,
161
- pub(crate) optional: bool,
162
- }
163
-
164
- create_from_statement! {Match}
165
-
166
- #[derive(Debug)]
167
- pub(crate) struct Return
168
- {
169
- pub(crate) all: bool,
170
- pub(crate) expressions: Vec<NamedExpression>,
171
- pub(crate) modifiers: Modifiers,
172
- pub(crate) where_expression: Option<Expression>,
173
- }
174
-
175
- create_from_statement! {Return}
176
-
177
- #[derive(Debug)]
178
- pub(crate) struct With
179
- {
180
- pub(crate) all: bool,
181
- pub(crate) expressions: Vec<NamedExpression>,
182
- pub(crate) modifiers: Modifiers,
183
- pub(crate) where_expression: Option<Expression>,
184
- }
185
-
186
- create_from_statement! {With}
187
-
188
- #[derive(Debug)]
189
- pub(crate) struct Unwind
190
- {
191
- pub(crate) identifier: VariableIdentifier,
192
- pub(crate) expression: Expression,
193
- }
194
-
195
- create_from_statement! {Unwind}
196
-
197
- #[derive(Debug)]
198
- pub(crate) struct Delete
199
- {
200
- pub(crate) detach: bool,
201
- pub(crate) expressions: Vec<Expression>,
202
- }
203
-
204
- #[derive(Debug)]
205
- pub(crate) struct Update
206
- {
207
- pub(crate) updates: Vec<OneUpdate>,
208
- }
209
-
210
- #[derive(Debug)]
211
- pub(crate) struct Call
212
- {
213
- pub(crate) name: String,
214
- pub(crate) arguments: Vec<Expression>,
215
- }
216
-
217
- // Set/remove Statements
218
-
219
- #[derive(Debug)]
220
- pub(crate) enum OneUpdate
221
- {
222
- SetProperty(UpdateProperty),
223
- AddProperty(UpdateProperty),
224
- RemoveProperty(RemoveProperty),
225
- AddLabels(AddRemoveLabels),
226
- RemoveLabels(AddRemoveLabels),
227
- }
228
-
229
- #[derive(Debug)]
230
- pub(crate) struct UpdateProperty
231
- {
232
- pub(crate) target: VariableIdentifier,
233
- pub(crate) path: Vec<String>,
234
- pub(crate) expression: Expression,
235
- }
236
-
237
- #[derive(Debug)]
238
- pub(crate) struct RemoveProperty
239
- {
240
- pub(crate) target: VariableIdentifier,
241
- pub(crate) path: Vec<String>,
242
- }
243
-
244
- #[derive(Debug)]
245
- pub(crate) struct AddRemoveLabels
246
- {
247
- pub(crate) target: VariableIdentifier,
248
- pub(crate) labels: Vec<String>,
249
- }
250
-
251
- // Modifiers
252
-
253
- #[derive(Debug)]
254
- pub(crate) struct OrderBy
255
- {
256
- pub(crate) expressions: Vec<OrderByExpression>,
257
- }
258
-
259
- #[derive(Default, Debug)]
260
- pub(crate) struct Modifiers
261
- {
262
- pub(crate) skip: Option<Expression>,
263
- pub(crate) limit: Option<Expression>,
264
- pub(crate) order_by: Option<OrderBy>,
265
- }
266
-
267
- // Expressions
268
-
269
- #[derive(Debug, Clone, PartialEq)]
270
- #[allow(clippy::large_enum_variant)]
271
- pub(crate) enum Expression
272
- {
273
- Array(Array),
274
- FunctionCall(FunctionCall),
275
- Map(Map),
276
- IndexAccess(Box<IndexAccess>),
277
- RangeAccess(Box<RangeAccess>),
278
- MemberAccess(Box<MemberAccess>),
279
- Parameter(Parameter),
280
- Value(Value),
281
- Variable(Variable),
282
-
283
- LogicalAnd(Box<LogicalAnd>),
284
- LogicalOr(Box<LogicalOr>),
285
- LogicalXor(Box<LogicalXor>),
286
- RelationalEqual(Box<RelationalEqual>),
287
- RelationalDifferent(Box<RelationalDifferent>),
288
- RelationalInferior(Box<RelationalInferior>),
289
- RelationalSuperior(Box<RelationalSuperior>),
290
- RelationalInferiorEqual(Box<RelationalInferiorEqual>),
291
- RelationalSuperiorEqual(Box<RelationalSuperiorEqual>),
292
- RelationalIn(Box<RelationalIn>),
293
- RelationalNotIn(Box<RelationalNotIn>),
294
-
295
- Addition(Box<Addition>),
296
- Subtraction(Box<Subtraction>),
297
- Multiplication(Box<Multiplication>),
298
- Division(Box<Division>),
299
- Modulo(Box<Modulo>),
300
- Exponent(Box<Exponent>),
301
-
302
- Negation(Box<Negation>),
303
- LogicalNegation(Box<LogicalNegation>),
304
- IsNull(Box<IsNull>),
305
- IsNotNull(Box<IsNotNull>),
306
- }
307
-
308
- // Order By Expression
309
-
310
- #[derive(Debug)]
311
- pub(crate) struct OrderByExpression
312
- {
313
- pub asc: bool,
314
- pub expression: Expression,
315
- }
316
-
317
- // Values: CreatePatterns
318
-
319
- #[derive(Debug)]
320
- pub(crate) enum Pattern
321
- {
322
- Node(NodePattern),
323
- Edge(EdgePattern),
324
- Path(PathPattern),
325
- }
326
-
327
- #[derive(Debug, Clone)]
328
- pub(crate) struct NodePattern
329
- {
330
- pub(crate) variable: Option<VariableIdentifier>,
331
- pub(crate) labels: LabelExpression,
332
- pub(crate) properties: Option<Expression>,
333
- }
334
-
335
- #[derive(Debug, Clone)]
336
- pub(crate) struct EdgePattern
337
- {
338
- pub(crate) variable: Option<VariableIdentifier>,
339
- pub(crate) source: NodePattern,
340
- pub(crate) destination: NodePattern,
341
- pub(crate) directivity: graph::EdgeDirectivity,
342
- pub(crate) labels: LabelExpression,
343
- pub(crate) properties: Option<Expression>,
344
- }
345
-
346
- #[derive(Debug, Clone)]
347
- pub(crate) struct PathPattern
348
- {
349
- pub(crate) variable: VariableIdentifier,
350
- pub(crate) edge: EdgePattern,
351
- }
352
-
353
- // Label Expression
354
- #[derive(Debug, Clone, PartialEq)]
355
- pub(crate) enum LabelExpression
356
- {
357
- #[allow(dead_code)]
358
- Not(Box<LabelExpression>),
359
- And(Vec<LabelExpression>),
360
- Or(Vec<LabelExpression>),
361
- String(String),
362
- None,
363
- }
364
-
365
- impl LabelExpression
366
- {
367
- pub(crate) fn and(self, rhs: LabelExpression) -> LabelExpression
368
- {
369
- match self
370
- {
371
- LabelExpression::None => rhs,
372
- LabelExpression::And(mut vec) => match rhs
373
- {
374
- LabelExpression::None => LabelExpression::And(vec),
375
- LabelExpression::And(mut rhs_vec) =>
376
- {
377
- vec.append(&mut rhs_vec);
378
- LabelExpression::And(vec)
379
- }
380
- other =>
381
- {
382
- vec.push(other);
383
- LabelExpression::And(vec)
384
- }
385
- },
386
- _ => match rhs
387
- {
388
- LabelExpression::None => self,
389
- LabelExpression::And(mut vec) =>
390
- {
391
- vec.push(self);
392
- LabelExpression::And(vec)
393
- }
394
- _ => LabelExpression::And(vec![self, rhs]),
395
- },
396
- }
397
- }
398
- pub(crate) fn or(self, rhs: LabelExpression) -> LabelExpression
399
- {
400
- match self
401
- {
402
- LabelExpression::None => rhs,
403
- LabelExpression::Or(mut vec) => match rhs
404
- {
405
- LabelExpression::None => LabelExpression::And(vec),
406
- LabelExpression::Or(mut rhs_vec) =>
407
- {
408
- vec.append(&mut rhs_vec);
409
- LabelExpression::Or(vec)
410
- }
411
- other =>
412
- {
413
- vec.push(other);
414
- LabelExpression::Or(vec)
415
- }
416
- },
417
- _ => match rhs
418
- {
419
- LabelExpression::None => self,
420
- LabelExpression::Or(mut vec) =>
421
- {
422
- vec.push(self);
423
- LabelExpression::Or(vec)
424
- }
425
- _ => LabelExpression::Or(vec![self, rhs]),
426
- },
427
- }
428
- }
429
- pub(crate) fn is_all_inclusive(&self) -> bool
430
- {
431
- match self
432
- {
433
- LabelExpression::None => true,
434
- LabelExpression::And(exprs) => !exprs.iter().any(|f| !f.is_all_inclusive()),
435
- LabelExpression::Or(_) => false,
436
- LabelExpression::String(_) => true,
437
- LabelExpression::Not(_) => false,
438
- }
439
- }
440
- pub(crate) fn is_none(&self) -> bool
441
- {
442
- matches!(self, LabelExpression::None)
443
- }
444
- pub(crate) fn is_string(&self) -> bool
445
- {
446
- matches!(self, LabelExpression::String(_))
447
- }
448
- }
449
-
450
- // Expressions
451
-
452
- macro_rules! create_from_expr {
453
- ( $x:tt ) => {
454
- impl From<$x> for Expression
455
- {
456
- fn from(v: $x) -> Expression
457
- {
458
- Expression::$x(v)
459
- }
460
- }
461
- };
462
- }
463
-
464
- macro_rules! create_from_boxed_expr {
465
- ( $x:tt ) => {
466
- impl From<$x> for Expression
467
- {
468
- fn from(v: $x) -> Expression
469
- {
470
- Expression::$x(Box::new(v))
471
- }
472
- }
473
- };
474
- }
475
-
476
- #[derive(Debug)]
477
- pub(crate) struct NamedExpression
478
- {
479
- pub(crate) identifier: VariableIdentifier,
480
- pub(crate) expression: Expression,
481
- }
482
-
483
- #[derive(Debug, Clone, PartialEq)]
484
- pub(crate) struct Parameter
485
- {
486
- pub(crate) name: String,
487
- }
488
-
489
- #[derive(Debug, Clone, PartialEq)]
490
- pub(crate) struct Variable
491
- {
492
- pub(crate) identifier: VariableIdentifier,
493
- }
494
-
495
- create_from_expr! {Variable}
496
-
497
- #[derive(Debug, Clone, PartialEq)]
498
- pub(crate) struct MemberAccess
499
- {
500
- pub(crate) left: Expression,
501
- pub(crate) path: Vec<String>,
502
- }
503
-
504
- create_from_boxed_expr! {MemberAccess}
505
-
506
- #[derive(Debug, Clone, PartialEq)]
507
- pub(crate) struct IndexAccess
508
- {
509
- pub(crate) left: Expression,
510
- pub(crate) index: Expression,
511
- }
512
-
513
- create_from_boxed_expr! {IndexAccess}
514
-
515
- #[derive(Debug, Clone, PartialEq)]
516
- pub(crate) struct RangeAccess
517
- {
518
- pub(crate) left: Expression,
519
- pub(crate) start: Option<Expression>,
520
- pub(crate) end: Option<Expression>,
521
- }
522
-
523
- #[derive(Debug, Clone, PartialEq)]
524
- pub(crate) struct FunctionCall
525
- {
526
- pub(crate) name: String,
527
- pub(crate) arguments: Vec<Expression>,
528
- }
529
-
530
- create_from_expr! {FunctionCall}
531
-
532
- macro_rules! create_binary_op {
533
- ( $x:tt ) => {
534
- #[derive(Debug, Clone, PartialEq)]
535
- pub(crate) struct $x
536
- {
537
- pub(crate) left: Expression,
538
- pub(crate) right: Expression,
539
- }
540
-
541
- create_from_boxed_expr! { $x }
542
- };
543
- }
544
-
545
- create_binary_op! {LogicalAnd}
546
- create_binary_op! {LogicalOr}
547
- create_binary_op! {LogicalXor}
548
- create_binary_op! {RelationalEqual}
549
- create_binary_op! {RelationalDifferent}
550
- create_binary_op! {RelationalInferior}
551
- create_binary_op! {RelationalSuperior}
552
- create_binary_op! {RelationalInferiorEqual}
553
- create_binary_op! {RelationalSuperiorEqual}
554
- create_binary_op! {RelationalIn}
555
- create_binary_op! {RelationalNotIn}
556
-
557
- create_binary_op! {Addition}
558
- create_binary_op! {Subtraction}
559
- create_binary_op! {Multiplication}
560
- create_binary_op! {Division}
561
- create_binary_op! {Modulo}
562
- create_binary_op! {Exponent}
563
-
564
- macro_rules! create_unary_op {
565
- ( $x:tt ) => {
566
- #[derive(Debug, Clone, PartialEq)]
567
- pub(crate) struct $x
568
- {
569
- pub(crate) value: Expression,
570
- }
571
- create_from_boxed_expr! { $x }
572
- };
573
- }
574
-
575
- create_unary_op! {LogicalNegation}
576
- create_unary_op! {Negation}
577
- create_unary_op! {IsNull}
578
- create_unary_op! {IsNotNull}
579
-
580
- // Values
581
-
582
- #[derive(Debug, Clone, PartialEq)]
583
- pub(crate) struct Value
584
- {
585
- pub(crate) value: crate::value::Value,
586
- }
587
-
588
- create_from_expr! {Value}
589
-
590
- #[derive(Debug, Clone, PartialEq)]
591
- pub(crate) struct Map
592
- {
593
- pub(crate) map: Vec<(String, Expression)>,
594
- }
595
-
596
- create_from_expr! {Map}
597
-
598
- #[derive(Debug, Clone, PartialEq)]
599
- pub(crate) struct Array
600
- {
601
- pub(crate) array: Vec<Expression>,
602
- }
603
-
604
- create_from_expr! {Array}