gqlite 1.2.3 → 1.3.1
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.
- checksums.yaml +4 -4
- data/ext/Cargo.toml +21 -0
- data/ext/gqlitedb/Cargo.toml +77 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/common/pokec.rs +30 -20
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/arithmetic.rs +1 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/stats.rs +27 -49
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators.rs +7 -7
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/capi.rs +10 -9
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/compiler/expression_analyser.rs +6 -4
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/compiler/variables_manager.rs +27 -31
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/compiler.rs +66 -59
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/connection.rs +42 -84
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/error.rs +105 -34
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/containers.rs +22 -27
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/edge.rs +2 -2
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/math.rs +2 -2
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/node.rs +1 -1
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/path.rs +16 -21
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/scalar.rs +25 -2
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/value.rs +6 -6
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions.rs +28 -20
- data/ext/gqlitedb/src/graph.rs +11 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/interpreter/evaluators.rs +163 -200
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/interpreter/instructions.rs +4 -3
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/lib.rs +8 -5
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/parser/ast.rs +44 -52
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/parser/gql.pest +1 -1
- data/ext/{gqliterb/vendor/gqlitedb/src/parser/parser.rs → gqlitedb/src/parser/parser_impl.rs} +50 -28
- data/ext/gqlitedb/src/parser.rs +4 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/prelude.rs +3 -2
- data/ext/gqlitedb/src/query_result.rs +88 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store/redb.rs +226 -148
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store/sqlite.rs +111 -128
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store.rs +22 -22
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/evaluators.rs +32 -76
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/store.rs +95 -111
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/templates/ast.rs +29 -29
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/templates/programs.rs +14 -14
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/value/compare.rs +13 -20
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/value/contains.rs +2 -2
- data/ext/gqlitedb/src/value.rs +225 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/value_table.rs +15 -5
- data/ext/gqliterb/Cargo.toml +12 -35
- data/ext/gqliterb/src/lib.rs +59 -39
- data/ext/graphcore/Cargo.toml +19 -0
- data/ext/graphcore/README.MD +4 -0
- data/ext/graphcore/release.toml +1 -0
- data/ext/graphcore/src/error.rs +28 -0
- data/ext/{gqliterb/vendor/gqlitedb → graphcore}/src/graph.rs +134 -38
- data/ext/graphcore/src/lib.rs +15 -0
- data/ext/graphcore/src/prelude.rs +4 -0
- data/ext/{gqliterb/vendor/gqlitedb → graphcore}/src/serialize_with.rs +2 -2
- data/ext/graphcore/src/table.rs +272 -0
- data/ext/{gqliterb/vendor/gqlitedb → graphcore}/src/value/value_map.rs +44 -49
- data/ext/graphcore/src/value.rs +413 -0
- metadata +92 -88
- data/ext/gqliterb/.cargo/config.toml +0 -2
- data/ext/gqliterb/Cargo.lock +0 -1116
- data/ext/gqliterb/vendor/gqlitedb/Cargo.lock +0 -2115
- data/ext/gqliterb/vendor/gqlitedb/Cargo.toml +0 -138
- data/ext/gqliterb/vendor/gqlitedb/src/parser.rs +0 -4
- data/ext/gqliterb/vendor/gqlitedb/src/value.rs +0 -609
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/askama.toml +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/common/mod.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/pokec_divan.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/pokec_iai.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/release.toml +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/containers.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/count.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/consts.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/string.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/interpreter/mod.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store/pgql.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/compiler.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/parser.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/store/redb.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/store/sqlite.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/templates.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/utils.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/call_stats.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_count_for_node.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_create.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_delete.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_delete_by_nodes.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_select.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_update.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/graph_create.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/graph_delete.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/metadata_create_table.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/metadata_get.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/metadata_set.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_create.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_delete.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_select.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_update.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/table_exists.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/upgrade_from_1_01.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/upgrade_graph_from_1_01.sql +0 -0
|
@@ -32,6 +32,29 @@ impl super::FunctionTrait for Coalesce
|
|
|
32
32
|
|
|
33
33
|
super::declare_function!(coalesce, Coalesce, custom_trait);
|
|
34
34
|
|
|
35
|
+
#[derive(Debug, Default)]
|
|
36
|
+
pub(super) struct Id {}
|
|
37
|
+
|
|
38
|
+
impl Id
|
|
39
|
+
{
|
|
40
|
+
fn call_impl(value: &value::Value) -> FResult<graph::Key>
|
|
41
|
+
{
|
|
42
|
+
match value
|
|
43
|
+
{
|
|
44
|
+
value::Value::Node(n) => Ok(n.key()),
|
|
45
|
+
value::Value::Edge(e) => Ok(e.key()),
|
|
46
|
+
_ => Err(RunTimeError::InvalidArgument {
|
|
47
|
+
function_name: "id",
|
|
48
|
+
index: 0,
|
|
49
|
+
expected_type: "node or edge",
|
|
50
|
+
value: format!("{:?}", value),
|
|
51
|
+
}),
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
super::declare_function!(id, Id, call_impl(crate::value::Value) -> graph::Key);
|
|
57
|
+
|
|
35
58
|
#[derive(Debug, Default)]
|
|
36
59
|
pub(super) struct ToInteger {}
|
|
37
60
|
|
|
@@ -70,8 +93,8 @@ impl Properties
|
|
|
70
93
|
{
|
|
71
94
|
match value
|
|
72
95
|
{
|
|
73
|
-
value::Value::Node(n) => Ok(n.properties.to_owned()),
|
|
74
|
-
value::Value::Edge(e) => Ok(e.properties.to_owned()),
|
|
96
|
+
value::Value::Node(n) => Ok(n.properties().to_owned()),
|
|
97
|
+
value::Value::Edge(e) => Ok(e.properties().to_owned()),
|
|
75
98
|
value::Value::Map(m) => Ok(m.to_owned()),
|
|
76
99
|
_ => Err(RunTimeError::InvalidArgument {
|
|
77
100
|
function_name: "properties",
|
|
@@ -11,8 +11,8 @@ impl HasLabel
|
|
|
11
11
|
{
|
|
12
12
|
match value
|
|
13
13
|
{
|
|
14
|
-
value::Value::Edge(e) => Ok(e.labels.contains(label)),
|
|
15
|
-
value::Value::Node(n) => Ok(n.labels.contains(label)),
|
|
14
|
+
value::Value::Edge(e) => Ok(e.labels().contains(label)),
|
|
15
|
+
value::Value::Node(n) => Ok(n.labels().contains(label)),
|
|
16
16
|
_ => Err(RunTimeError::InvalidArgument {
|
|
17
17
|
function_name: "has_label",
|
|
18
18
|
index: 0,
|
|
@@ -45,11 +45,11 @@ impl super::FunctionTrait for HasLabels
|
|
|
45
45
|
}
|
|
46
46
|
else
|
|
47
47
|
{
|
|
48
|
-
let mut it = arguments.
|
|
48
|
+
let mut it = arguments.iter();
|
|
49
49
|
let labels = match it.next().unwrap()
|
|
50
50
|
{
|
|
51
|
-
value::Value::Edge(e) => e.labels,
|
|
52
|
-
value::Value::Node(n) => n.labels,
|
|
51
|
+
value::Value::Edge(e) => e.labels(),
|
|
52
|
+
value::Value::Node(n) => n.labels(),
|
|
53
53
|
value::Value::Null => return Ok(value::Value::Null),
|
|
54
54
|
_ => Err(RunTimeError::InvalidArgument {
|
|
55
55
|
function_name: "has_labels",
|
|
@@ -64,7 +64,7 @@ impl super::FunctionTrait for HasLabels
|
|
|
64
64
|
{
|
|
65
65
|
value::Value::String(l) =>
|
|
66
66
|
{
|
|
67
|
-
if !labels.contains(
|
|
67
|
+
if !labels.contains(l)
|
|
68
68
|
{
|
|
69
69
|
return Ok(false.into());
|
|
70
70
|
}
|
|
@@ -59,6 +59,13 @@ impl FunctionTypeTrait for f64
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
impl FunctionTypeTrait for graph::Key
|
|
63
|
+
{
|
|
64
|
+
fn result_type() -> ExpressionType
|
|
65
|
+
{
|
|
66
|
+
ExpressionType::Key
|
|
67
|
+
}
|
|
68
|
+
}
|
|
62
69
|
impl<T> FunctionTypeTrait for Vec<T>
|
|
63
70
|
{
|
|
64
71
|
fn result_type() -> ExpressionType
|
|
@@ -133,24 +140,25 @@ impl Manager
|
|
|
133
140
|
Self {
|
|
134
141
|
inner: ManagerInner {
|
|
135
142
|
functions: HashMap::from([
|
|
136
|
-
containers::Head::
|
|
137
|
-
containers::Keys::
|
|
138
|
-
containers::Range::
|
|
139
|
-
containers::Size::
|
|
140
|
-
edge::Type::
|
|
141
|
-
math::Ceil::
|
|
142
|
-
math::Floor::
|
|
143
|
-
math::Rand::
|
|
144
|
-
node::Labels::
|
|
145
|
-
path::Length::
|
|
146
|
-
path::Nodes::
|
|
147
|
-
path::Edges::
|
|
148
|
-
scalar::Coalesce::
|
|
149
|
-
scalar::
|
|
150
|
-
scalar::
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
value::
|
|
143
|
+
containers::Head::create(),
|
|
144
|
+
containers::Keys::create(),
|
|
145
|
+
containers::Range::create(),
|
|
146
|
+
containers::Size::create(),
|
|
147
|
+
edge::Type::create(),
|
|
148
|
+
math::Ceil::create(),
|
|
149
|
+
math::Floor::create(),
|
|
150
|
+
math::Rand::create(),
|
|
151
|
+
node::Labels::create(),
|
|
152
|
+
path::Length::create(),
|
|
153
|
+
path::Nodes::create(),
|
|
154
|
+
path::Edges::create(),
|
|
155
|
+
scalar::Coalesce::create(),
|
|
156
|
+
scalar::Id::create(),
|
|
157
|
+
scalar::Properties::create(),
|
|
158
|
+
scalar::ToInteger::create(),
|
|
159
|
+
string::ToString::create(),
|
|
160
|
+
value::HasLabel::create(),
|
|
161
|
+
value::HasLabels::create(),
|
|
154
162
|
]),
|
|
155
163
|
aggregators: aggregators::init_aggregators(),
|
|
156
164
|
}
|
|
@@ -323,7 +331,7 @@ macro_rules! declare_function_ {
|
|
|
323
331
|
($function_name: ident, $type_name: ty, $f_name: ident ( $( $arg_type: ty $(,)? )* ) -> $ret_type: ty, $allow_null: expr, $validator: block ) => {
|
|
324
332
|
impl $type_name
|
|
325
333
|
{
|
|
326
|
-
pub(super) fn
|
|
334
|
+
pub(super) fn create() -> (String, crate::functions::Function)
|
|
327
335
|
{
|
|
328
336
|
(
|
|
329
337
|
stringify!($function_name).to_string(),
|
|
@@ -389,7 +397,7 @@ macro_rules! declare_function {
|
|
|
389
397
|
($function_name: ident, $type_name: ty, custom_trait ) => {
|
|
390
398
|
impl $type_name
|
|
391
399
|
{
|
|
392
|
-
pub(super) fn
|
|
400
|
+
pub(super) fn create() -> (String, crate::functions::Function)
|
|
393
401
|
{
|
|
394
402
|
(
|
|
395
403
|
stringify!($function_name).to_string(),
|