gqlite 1.2.2 → 1.2.3

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gqliterb/Cargo.lock +27 -20
  3. data/ext/gqliterb/Cargo.toml +3 -2
  4. data/ext/gqliterb/src/lib.rs +7 -1
  5. data/ext/gqliterb/vendor/gqlitedb/Cargo.lock +88 -33
  6. data/ext/gqliterb/vendor/gqlitedb/Cargo.toml +7 -1
  7. data/ext/gqliterb/vendor/gqlitedb/release.toml +2 -2
  8. data/ext/gqliterb/vendor/gqlitedb/src/capi.rs +24 -1
  9. data/ext/gqliterb/vendor/gqlitedb/src/compiler/expression_analyser.rs +4 -0
  10. data/ext/gqliterb/vendor/gqlitedb/src/compiler/variables_manager.rs +9 -8
  11. data/ext/gqliterb/vendor/gqlitedb/src/compiler.rs +9 -0
  12. data/ext/gqliterb/vendor/gqlitedb/src/connection.rs +192 -58
  13. data/ext/gqliterb/vendor/gqlitedb/src/error.rs +8 -16
  14. data/ext/gqliterb/vendor/gqlitedb/src/functions/edge.rs +1 -1
  15. data/ext/gqliterb/vendor/gqlitedb/src/functions/math.rs +1 -1
  16. data/ext/gqliterb/vendor/gqlitedb/src/functions/node.rs +1 -1
  17. data/ext/gqliterb/vendor/gqlitedb/src/functions/path.rs +33 -1
  18. data/ext/gqliterb/vendor/gqlitedb/src/functions/scalar.rs +1 -1
  19. data/ext/gqliterb/vendor/gqlitedb/src/functions/string.rs +1 -1
  20. data/ext/gqliterb/vendor/gqlitedb/src/functions/value.rs +1 -1
  21. data/ext/gqliterb/vendor/gqlitedb/src/functions.rs +11 -13
  22. data/ext/gqliterb/vendor/gqlitedb/src/graph.rs +15 -0
  23. data/ext/gqliterb/vendor/gqlitedb/src/interpreter/evaluators.rs +21 -33
  24. data/ext/gqliterb/vendor/gqlitedb/src/interpreter/instructions.rs +6 -1
  25. data/ext/gqliterb/vendor/gqlitedb/src/lib.rs +1 -2
  26. data/ext/gqliterb/vendor/gqlitedb/src/parser/ast.rs +10 -24
  27. data/ext/gqliterb/vendor/gqlitedb/src/parser/gql.pest +8 -3
  28. data/ext/gqliterb/vendor/gqlitedb/src/parser/parser.rs +36 -6
  29. data/ext/gqliterb/vendor/gqlitedb/src/store/redb.rs +36 -24
  30. data/ext/gqliterb/vendor/gqlitedb/src/store/sqlite.rs +50 -18
  31. data/ext/gqliterb/vendor/gqlitedb/src/store.rs +9 -2
  32. data/ext/gqliterb/vendor/gqlitedb/src/tests/evaluators.rs +9 -9
  33. data/ext/gqliterb/vendor/gqlitedb/src/tests/store/redb.rs +12 -5
  34. data/ext/gqliterb/vendor/gqlitedb/src/tests/store/sqlite.rs +12 -5
  35. data/ext/gqliterb/vendor/gqlitedb/src/tests/store.rs +11 -3
  36. data/ext/gqliterb/vendor/gqlitedb/src/value.rs +54 -4
  37. data/ext/gqliterb/vendor/gqlitedb/src/value_table.rs +7 -13
  38. metadata +2 -2
@@ -1,6 +1,77 @@
1
+ use std::path::Path;
2
+
1
3
  use crate::prelude::*;
2
4
  use value::ValueTryIntoRef;
3
5
 
6
+ /// Backend
7
+ pub enum Backend
8
+ {
9
+ /// Select the first available backend.
10
+ Automatic,
11
+ /// SQLite backend.
12
+ #[cfg(feature = "sqlite")]
13
+ SQLite,
14
+ /// Redb backend.
15
+ #[cfg(feature = "redb")]
16
+ Redb,
17
+ }
18
+
19
+ /// Builder with high-level API for creating connection.
20
+ pub struct ConnectionBuilder
21
+ {
22
+ map: value::ValueMap,
23
+ }
24
+
25
+ impl ConnectionBuilder
26
+ {
27
+ /// Merge options. This might overwrite value from the builder
28
+ pub fn options(mut self, options: value::ValueMap) -> Self
29
+ {
30
+ for (k, v) in options.into_iter()
31
+ {
32
+ self.map.insert(k, v);
33
+ }
34
+ self
35
+ }
36
+ /// Set path
37
+ pub fn path<P: AsRef<Path>>(mut self, p: P) -> Self
38
+ {
39
+ self.map.insert(
40
+ "path".to_string(),
41
+ p.as_ref().to_string_lossy().as_ref().into(),
42
+ );
43
+ self
44
+ }
45
+ /// Set backend
46
+ pub fn backend(mut self, backend: Backend) -> Self
47
+ {
48
+ let key = "backend".into();
49
+ match backend
50
+ {
51
+ Backend::Automatic =>
52
+ {
53
+ self.map.insert(key, "automatic".into());
54
+ }
55
+ #[cfg(feature = "sqlite")]
56
+ Backend::SQLite =>
57
+ {
58
+ self.map.insert(key, "sqlite".into());
59
+ }
60
+ #[cfg(feature = "redb")]
61
+ Backend::Redb =>
62
+ {
63
+ self.map.insert(key, "redb".into());
64
+ }
65
+ }
66
+ self
67
+ }
68
+ /// Create the connection
69
+ pub fn create(self) -> Result<Connection>
70
+ {
71
+ Connection::create(self.map)
72
+ }
73
+ }
74
+
4
75
  trait ConnectionTrait: Sync + Send
5
76
  {
6
77
  fn execute_query(&self, query: String, parameters: value::ValueMap) -> Result<value::Value>;
@@ -98,92 +169,155 @@ ccutils::assert_impl_all!(Connection: Sync, Send);
98
169
 
99
170
  impl Connection
100
171
  {
101
- /// Open a `path` that contains a `GQLite` database. The `options` parameter can
172
+ /// Create a new connection to a `GQLite` database. The `options` parameter can
102
173
  /// be used to select the backend, and configure the backend.
103
174
  ///
104
175
  /// Supported parameters:
105
- /// - `backend` can be `redb` or `sqlite`
176
+ /// - `path` a path to a file, if not present, an in-memory database is created
177
+ /// - `backend` for instance `redb` or `sqlite` (the [Self::available_backends] function contains the list of compiled backends)
106
178
  ///
107
179
  /// If the `backend` is not specified, the `open` function will attempt to guess it
108
180
  /// for existing databases. For new database, depending on availability, it will
109
181
  /// create a `sqlite` database, or a `redb` database.
110
182
  ///
111
- /// Example of use:
183
+ /// Example of use, this will create an in-memory database:
112
184
  ///
113
185
  /// ```rust
114
186
  /// # use gqlitedb::Connection;
115
187
  /// # fn example() -> gqlitedb::Result<()> {
116
- /// let connection = Connection::open("filename.db", gqlitedb::map!("backend" => "redb"))?;
188
+ /// let connection = Connection::create(gqlitedb::map!("backend" => "redb"))?;
117
189
  /// # Ok(()) }
118
190
  /// ```
119
- #[cfg(any(feature = "redb", feature = "sqlite"))]
120
- pub fn open<P: AsRef<std::path::Path>>(path: P, options: value::ValueMap) -> Result<Connection>
191
+ pub fn create(options: value::ValueMap) -> Result<Connection>
121
192
  {
122
- if let Some(backend) = options.get("backend")
193
+ let backend = options.get("backend").map_or_else(
194
+ || Ok("automatic".to_string()),
195
+ |x| x.try_into_ref().map(|x: &String| x.to_owned()),
196
+ )?;
197
+ match backend.as_str()
123
198
  {
124
- let backend: &String = backend.try_into_ref()?;
125
- match backend.as_str()
199
+ "automatic" =>
126
200
  {
127
- "sqlite" => Self::open_sqlite(path),
128
- "redb" => Self::open_redb(path),
129
- _ => Err(
130
- StoreError::UnknownBackend {
131
- backend: backend.to_owned(),
201
+ #[cfg(feature = "sqlite")]
202
+ let sq_e = {
203
+ let mut options = options.clone();
204
+ options.insert("backend".into(), "sqlite".into());
205
+ Self::create(options)
206
+ };
207
+ #[cfg(not(feature = "sqlite"))]
208
+ let sq_e = Err(error::StoreError::UnavailableBackend { backend: "sqlite" }.into());
209
+ let sq_r = match sq_e
210
+ {
211
+ Ok(sq) => Ok(sq),
212
+ Err(sq_e) =>
213
+ {
214
+ #[cfg(feature = "redb")]
215
+ let sq_r = {
216
+ let mut options = options;
217
+ options.insert("backend".into(), "redb".into());
218
+ Self::create(options)
219
+ };
220
+ #[cfg(not(feature = "redb"))]
221
+ let sq_r = Err(error::StoreError::UnavailableBackend { backend: "redb" }.into());
222
+
223
+ sq_r.map_err(|rb_e| {
224
+ StoreError::OpeningError {
225
+ errors: error::vec_to_error::<ErrorType>(&vec![sq_e, rb_e]),
226
+ }
227
+ .into()
228
+ })
132
229
  }
133
- .into(),
134
- ),
230
+ };
231
+ sq_r
135
232
  }
136
- }
137
- else
138
- {
139
- Self::open_sqlite(path.as_ref().to_owned()).or_else(|sq_e| {
140
- Self::open_redb(path).map_err(|rb_e| {
141
- StoreError::OpeningError {
142
- errors: error::vec_to_error::<ErrorType>(&vec![sq_e, rb_e]),
233
+ #[cfg(feature = "sqlite")]
234
+ "sqlite" =>
235
+ {
236
+ let store = if let Some(path) = options.get("path")
237
+ {
238
+ let path: &String = path.try_into_ref()?;
239
+ store::sqlite::Store::open(path)?
240
+ }
241
+ else
242
+ {
243
+ store::sqlite::Store::in_memory()?
244
+ };
245
+ Ok(Connection {
246
+ connection: ConnectionImpl {
247
+ store,
248
+ function_manager: functions::Manager::new(),
143
249
  }
144
- .into()
250
+ .boxed(),
145
251
  })
146
- })
147
- }
148
- }
149
- #[cfg(feature = "sqlite")]
150
- fn open_sqlite<P: AsRef<std::path::Path>>(path: P) -> Result<Connection>
151
- {
152
- Ok(Connection {
153
- connection: ConnectionImpl {
154
- store: store::sqlite::Store::new(path)?,
155
- function_manager: functions::Manager::new(),
156
252
  }
157
- .boxed(),
158
- })
159
- }
160
- #[cfg(not(feature = "sqlite"))]
161
- fn open_sqlite<P: AsRef<std::path::Path>>(_: P) -> Result<Connection>
162
- {
163
- Err(error::ConnectionError::UnavailableBackend { backend: "sqlite" }.into())
253
+ #[cfg(feature = "redb")]
254
+ "redb" =>
255
+ {
256
+ let store = if let Some(path) = options.get("path")
257
+ {
258
+ let path: &String = path.try_into_ref()?;
259
+ store::redb::Store::open(path)?
260
+ }
261
+ else
262
+ {
263
+ store::redb::Store::in_memory()?
264
+ };
265
+ Ok(Connection {
266
+ connection: ConnectionImpl {
267
+ store,
268
+ function_manager: functions::Manager::new(),
269
+ }
270
+ .boxed(),
271
+ })
272
+ }
273
+ _ => Err(StoreError::UnknownBackend { backend }.into()),
274
+ }
164
275
  }
165
- #[cfg(feature = "redb")]
166
- fn open_redb<P: AsRef<std::path::Path>>(path: P) -> Result<Connection>
276
+ /// Create a builder, with a high-level API to set the options.
277
+ /// Example of use:
278
+ /// ```
279
+ /// let connection = Connection::builder().path("path/to/file").backend(Backend::SQLite).create()?;
280
+ /// ```
281
+ pub fn builder() -> ConnectionBuilder
167
282
  {
168
- Ok(Connection {
169
- connection: ConnectionImpl {
170
- store: store::redb::Store::new(path)?,
171
- function_manager: functions::Manager::new(),
172
- }
173
- .boxed(),
174
- })
283
+ ConnectionBuilder {
284
+ map: Default::default(),
285
+ }
175
286
  }
176
- #[cfg(not(feature = "redb"))]
177
- fn open_redb<P: AsRef<std::path::Path>>(_: P) -> Result<Connection>
287
+ /// List of available backends
288
+ pub fn available_backends() -> Vec<String>
178
289
  {
179
- Err(error::StoreError::UnavailableBackend { backend: "redb" }.into())
290
+ let mut backends = vec![];
291
+ #[cfg(feature = "sqlite")]
292
+ backends.push("sqlite".to_string());
293
+ #[cfg(feature = "redb")]
294
+ backends.push("redb".to_string());
295
+ backends
180
296
  }
181
- #[cfg(feature = "_pgql")]
182
- pub fn create() -> Result<Connection>
297
+
298
+ /// Open a `path` that contains a `GQLite` database. The `options` parameter can
299
+ /// be used to select the backend, and configure the backend.
300
+ ///
301
+ /// Supported parameters:
302
+ /// - `backend` can be `redb` or `sqlite`
303
+ ///
304
+ /// If the `backend` is not specified, the `open` function will attempt to guess it
305
+ /// for existing databases. For new database, depending on availability, it will
306
+ /// create a `sqlite` database, or a `redb` database.
307
+ ///
308
+ /// Example of use:
309
+ ///
310
+ /// ```rust
311
+ /// # use gqlitedb::Connection;
312
+ /// # fn example() -> gqlitedb::Result<()> {
313
+ /// let connection = Connection::open("filename.db", gqlitedb::map!("backend" => "redb"))?;
314
+ /// # Ok(()) }
315
+ /// ```
316
+ #[cfg(any(feature = "redb", feature = "sqlite"))]
317
+ #[deprecated = "Use create or builder instead."]
318
+ pub fn open<P: AsRef<std::path::Path>>(path: P, options: value::ValueMap) -> Result<Connection>
183
319
  {
184
- Ok(Connection {
185
- store: store::Store::new()?,
186
- })
320
+ Self::builder().options(options).path(path).create()
187
321
  }
188
322
  /// Execute the `query` (using OpenCypher), given the query `parameters` (sometimes
189
323
  /// also referred as binding).
@@ -52,7 +52,7 @@ pub enum CompileTimeError
52
52
  NoSingleRelationshipType,
53
53
  #[error("NotComparable: values are not comparable.")]
54
54
  NotComparable,
55
- #[error("UnknownFunction: {name}")]
55
+ #[error("UnknownFunction: {name}.")]
56
56
  UnknownFunction
57
57
  {
58
58
  name: String
@@ -120,7 +120,7 @@ pub enum RunTimeError
120
120
  /// Edge has no label
121
121
  #[error("MissingEdgeLabel")]
122
122
  MissingEdgeLabel,
123
- #[error("UnknownFunction: {name}")]
123
+ #[error("UnknownFunction: {name}.")]
124
124
  UnknownFunction
125
125
  {
126
126
  name: String
@@ -372,11 +372,7 @@ pub enum Error
372
372
  Internal(#[from] InternalError),
373
373
  }
374
374
 
375
- fn assert_send_sync<T: Send + Sync>() {}
376
- fn _check_error_send_sync()
377
- {
378
- assert_send_sync::<Error>();
379
- }
375
+ ccutils::assert_impl_all!(Error: Send, Sync);
380
376
 
381
377
  impl Error
382
378
  {
@@ -402,12 +398,14 @@ impl Error
402
398
  // |_____|_| |_| \___/|_| \_/\_/ |_|\__|_| |_|____/ \__,_|\___|_|\_\\__|_| \__,_|\___\___|
403
399
 
404
400
  #[derive(Debug)]
401
+ #[cfg(feature = "_backtrace")]
405
402
  pub struct ErrorWithBacktrace
406
403
  {
407
404
  error: Error,
408
405
  backtrace: std::backtrace::Backtrace,
409
406
  }
410
407
 
408
+ #[cfg(feature = "_backtrace")]
411
409
  impl ErrorWithBacktrace
412
410
  {
413
411
  /// Return the underlying error
@@ -425,6 +423,7 @@ impl ErrorWithBacktrace
425
423
  }
426
424
  }
427
425
 
426
+ #[cfg(feature = "_backtrace")]
428
427
  impl std::fmt::Display for ErrorWithBacktrace
429
428
  {
430
429
  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
@@ -432,6 +431,8 @@ impl std::fmt::Display for ErrorWithBacktrace
432
431
  self.error.fmt(f)
433
432
  }
434
433
  }
434
+
435
+ #[cfg(feature = "_backtrace")]
435
436
  impl<T> From<T> for ErrorWithBacktrace
436
437
  where
437
438
  T: Into<Error>,
@@ -579,7 +580,6 @@ impl From<std::convert::Infallible> for Error
579
580
  pub(crate) trait GenericErrors: Into<Error>
580
581
  {
581
582
  fn unknown_function(name: impl Into<String>) -> Self;
582
- fn not_comparable() -> Self;
583
583
  }
584
584
 
585
585
  impl GenericErrors for CompileTimeError
@@ -588,10 +588,6 @@ impl GenericErrors for CompileTimeError
588
588
  {
589
589
  Self::UnknownFunction { name: name.into() }
590
590
  }
591
- fn not_comparable() -> Self
592
- {
593
- Self::NotComparable
594
- }
595
591
  }
596
592
 
597
593
  impl GenericErrors for RunTimeError
@@ -600,10 +596,6 @@ impl GenericErrors for RunTimeError
600
596
  {
601
597
  Self::UnknownFunction { name: name.into() }
602
598
  }
603
- fn not_comparable() -> Self
604
- {
605
- Self::NotComparable
606
- }
607
599
  }
608
600
 
609
601
  /// GQLite Result
@@ -1,6 +1,6 @@
1
1
  use crate::prelude::*;
2
2
 
3
- use super::{FResult, FunctionTypeTrait};
3
+ use super::FResult;
4
4
 
5
5
  #[derive(Debug, Default)]
6
6
  pub(super) struct Type {}
@@ -2,7 +2,7 @@ use rand::Rng;
2
2
 
3
3
  use crate::prelude::*;
4
4
 
5
- use super::{FResult, FunctionTypeTrait};
5
+ use super::FResult;
6
6
 
7
7
  #[derive(Debug, Default)]
8
8
  pub(super) struct Rand {}
@@ -1,6 +1,6 @@
1
1
  use crate::prelude::*;
2
2
 
3
- use super::{FResult, FunctionTypeTrait};
3
+ use super::FResult;
4
4
 
5
5
  #[derive(Debug, Default)]
6
6
  pub(super) struct Labels {}
@@ -1,5 +1,5 @@
1
1
  use super::ExpressionType;
2
- use crate::prelude::*;
2
+ use crate::{functions::FResult, prelude::*};
3
3
 
4
4
  #[derive(Debug, Default)]
5
5
  pub(super) struct Length {}
@@ -46,3 +46,35 @@ impl super::FunctionTrait for Length
46
46
  }
47
47
 
48
48
  super::declare_function!(length, Length, custom_trait);
49
+
50
+ #[derive(Debug, Default)]
51
+ pub(super) struct Nodes {}
52
+
53
+ impl Nodes
54
+ {
55
+ fn call_impl(path: &graph::Path) -> FResult<Vec<graph::Node>>
56
+ {
57
+ Ok(vec![path.source.clone(), path.destination.clone()])
58
+ }
59
+ }
60
+
61
+ super::declare_function!(nodes, Nodes, call_impl(crate::graph::Path) -> Vec<graph::Node>);
62
+
63
+ #[derive(Debug, Default)]
64
+ pub(super) struct Edges {}
65
+
66
+ impl Edges
67
+ {
68
+ fn call_impl(path: &graph::Path) -> FResult<Vec<graph::Edge>>
69
+ {
70
+ Ok(vec![graph::Edge {
71
+ key: path.key.clone(),
72
+ source: path.source.clone(),
73
+ destination: path.destination.clone(),
74
+ properties: path.properties.clone(),
75
+ labels: path.labels.clone(),
76
+ }])
77
+ }
78
+ }
79
+
80
+ super::declare_function!(edges, Edges, call_impl(crate::graph::Path) -> Vec<graph::Edge>);
@@ -59,7 +59,7 @@ impl ToInteger
59
59
  }
60
60
  }
61
61
 
62
- super::declare_function!(toInteger, ToInteger, call_impl(crate::value::Value) -> i64);
62
+ super::declare_function!(tointeger, ToInteger, call_impl(crate::value::Value) -> i64);
63
63
 
64
64
  #[derive(Debug, Default)]
65
65
  pub(super) struct Properties {}
@@ -25,4 +25,4 @@ impl ToString
25
25
  }
26
26
  }
27
27
 
28
- super::declare_function!(toString, ToString, call_impl(crate::value::Value) -> String, validate_args(ExpressionType::Boolean | ExpressionType::Integer | ExpressionType::Float | ExpressionType::String | ExpressionType::Null));
28
+ super::declare_function!(tostring, ToString, call_impl(crate::value::Value) -> String, validate_args(ExpressionType::Boolean | ExpressionType::Integer | ExpressionType::Float | ExpressionType::String | ExpressionType::Null));
@@ -1,6 +1,6 @@
1
1
  use crate::prelude::*;
2
2
 
3
- use super::{ExpressionType, FResult, FunctionTypeTrait};
3
+ use super::{ExpressionType, FResult};
4
4
 
5
5
  #[derive(Debug, Default)]
6
6
  pub(super) struct HasLabel {}
@@ -143,6 +143,8 @@ impl Manager
143
143
  math::Rand::new(),
144
144
  node::Labels::new(),
145
145
  path::Length::new(),
146
+ path::Nodes::new(),
147
+ path::Edges::new(),
146
148
  scalar::Coalesce::new(),
147
149
  scalar::Properties::new(),
148
150
  scalar::ToInteger::new(),
@@ -155,34 +157,29 @@ impl Manager
155
157
  .into(),
156
158
  }
157
159
  }
158
- pub(crate) fn get_function<E: error::GenericErrors>(
159
- &self,
160
- name: impl Into<String>,
161
- ) -> Result<Function>
160
+ pub(crate) fn get_function<E: error::GenericErrors>(&self, name: &str) -> Result<Function>
162
161
  {
163
- let name = name.into();
164
162
  Ok(
165
163
  self
166
164
  .inner
167
165
  .read()?
168
166
  .functions
169
- .get(&name)
167
+ .get(&name.to_lowercase())
170
168
  .ok_or_else(|| E::unknown_function(name).into())?
171
169
  .clone(),
172
170
  )
173
171
  }
174
172
  pub(crate) fn get_aggregator<E: error::GenericErrors>(
175
173
  &self,
176
- name: impl Into<String>,
174
+ name: &str,
177
175
  ) -> Result<aggregators::Aggregator>
178
176
  {
179
- let name = name.into();
180
177
  Ok(
181
178
  self
182
179
  .inner
183
180
  .read()?
184
181
  .aggregators
185
- .get(&name)
182
+ .get(&name.to_lowercase())
186
183
  .ok_or_else(|| E::unknown_function(name).into())?
187
184
  .clone(),
188
185
  )
@@ -190,13 +187,13 @@ impl Manager
190
187
  pub(crate) fn is_deterministic(&self, name: impl Into<String>) -> Result<bool>
191
188
  {
192
189
  let name = name.into();
193
- let fun = self.get_function::<crate::error::CompileTimeError>(name.clone());
190
+ let fun = self.get_function::<crate::error::CompileTimeError>(&name);
194
191
  match fun
195
192
  {
196
193
  Ok(fun) => Ok(fun.is_deterministic()),
197
194
  Err(_) =>
198
195
  {
199
- self.get_aggregator::<crate::error::CompileTimeError>(name)?;
196
+ self.get_aggregator::<crate::error::CompileTimeError>(&name)?;
200
197
  Ok(false)
201
198
  }
202
199
  }
@@ -213,12 +210,12 @@ impl Manager
213
210
  ) -> Result<ExpressionType>
214
211
  {
215
212
  let name = name.into();
216
- let fun = self.get_function::<crate::error::CompileTimeError>(name.clone());
213
+ let fun = self.get_function::<crate::error::CompileTimeError>(&name);
217
214
  match fun
218
215
  {
219
216
  Ok(fun) => fun.validate_arguments(arguments),
220
217
  Err(_) => self
221
- .get_aggregator::<crate::error::CompileTimeError>(name)?
218
+ .get_aggregator::<crate::error::CompileTimeError>(&name)?
222
219
  .validate_arguments(arguments),
223
220
  }
224
221
  }
@@ -288,6 +285,7 @@ macro_rules! default_validate_ {
288
285
  -> crate::Result<$crate::compiler::expression_analyser::ExpressionType>
289
286
  {
290
287
  // TODO
288
+ use $crate::functions::FunctionTypeTrait;
291
289
  Ok(<$ret_type>::result_type())
292
290
  }
293
291
  };
@@ -99,6 +99,11 @@ impl Node
99
99
  {
100
100
  (self.key, self.labels, self.properties)
101
101
  }
102
+ /// Convert into value map representation
103
+ pub fn into_value_map(self) -> value::ValueMap
104
+ {
105
+ crate::map!("labels" => self.labels, "properties" => self.properties, "type" => "node")
106
+ }
102
107
  }
103
108
 
104
109
  impl std::fmt::Display for Node
@@ -159,6 +164,11 @@ impl Edge
159
164
  {
160
165
  (self.key, self.labels, self.properties)
161
166
  }
167
+ /// Convert into value map representation
168
+ pub fn into_value_map(self) -> value::ValueMap
169
+ {
170
+ crate::map!( "labels" => self.labels, "properties" => self.properties, "type" => "edge")
171
+ }
162
172
  }
163
173
 
164
174
  impl std::fmt::Display for Edge
@@ -240,6 +250,11 @@ impl Path
240
250
  self.destination,
241
251
  )
242
252
  }
253
+ /// Convert into value map representation
254
+ pub fn into_value_map(self) -> value::ValueMap
255
+ {
256
+ crate::map!( "source" => self.source, "labels" => self.labels, "properties" => self.properties, "destination" => self.destination, "type" => "path")
257
+ }
243
258
  }
244
259
 
245
260
  impl std::fmt::Display for Path