From 105a6e3be3ab566a90f5af93f0df2d85af231a8c Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 29 Jul 2024 16:56:51 +0200 Subject: [PATCH] [tests] Change test_queries to list #1166 (#1167) update test org --- agdb_api/typescript/query_test_generator.js | 7 +- agdb_api/typescript/tests/query.test.ts | 1220 ++--- agdb_server/openapi/test_queries.json | 4889 ++++++++++--------- agdb_server/src/main.rs | 7 +- 4 files changed, 3158 insertions(+), 2965 deletions(-) diff --git a/agdb_api/typescript/query_test_generator.js b/agdb_api/typescript/query_test_generator.js index eea3244f..bd514a01 100644 --- a/agdb_api/typescript/query_test_generator.js +++ b/agdb_api/typescript/query_test_generator.js @@ -12,8 +12,9 @@ class T { db_id: undefined = undefined; value1: string = ""; value2: number = 0; \n\n describe("query tests", () => {`; -for (let query in test_queries) { - let builder = query; +for (let index in test_queries) { + let name = test_queries[index][0]; + let builder = test_queries[index][0]; builder = builder.replace(/&/g, ""); builder = builder.replace(/T::default\(\)/g, "new T()"); builder = builder.replace(/::/g, "."); @@ -25,7 +26,7 @@ for (let query in test_queries) { builder = builder.replace(/\("k",2\)/g, "[\"k\", 2]"); builder = builder.replace(/\(1,10\)/g, "[1, 10]"); - tests += `it(\`${query}\`, () => { let query = \`${query}\`;\nlet builder = ${builder};\nexpect(builder).toEqual(test_queries[query]); });\n\n`; + tests += `it(\`${name}\`, () => { let query = ${builder};\nexpect(query).toEqual(test_queries[${index}][1]); });\n\n`; } tests += `});`; diff --git a/agdb_api/typescript/tests/query.test.ts b/agdb_api/typescript/tests/query.test.ts index 75d3ef9e..2b08871e 100644 --- a/agdb_api/typescript/tests/query.test.ts +++ b/agdb_api/typescript/tests/query.test.ts @@ -18,404 +18,304 @@ class T { } describe("query tests", () => { - it(`QueryBuilder::insert().values_uniform(vec![("k","v").into(),(1,10).into()]).ids(QueryBuilder::search().from("a").query()).query()`, () => { - let query = `QueryBuilder::insert().values_uniform(vec![("k","v").into(),(1,10).into()]).ids(QueryBuilder::search().from("a").query()).query()`; - let builder = QueryBuilder.insert() - .values_uniform([ - ["k", "v"], - [1, 10], - ]) - .ids(QueryBuilder.search().from("a").query()) - .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::search().to(1).order_by(vec![DbKeyOrder::Asc("k".into())]).where_().node().query()`, () => { - let query = `QueryBuilder::search().to(1).order_by(vec![DbKeyOrder::Asc("k".into())]).where_().node().query()`; - let builder = QueryBuilder.search() - .to(1) - .order_by([DbKeyOrder.Asc("k")]) - .where() - .node() - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().aliases("a").ids(1).query()`, () => { + let query = QueryBuilder.insert().aliases("a").ids(1).query(); + expect(query).toEqual(test_queries[0][1]); }); - it(`QueryBuilder::remove().index("key").query()`, () => { - let query = `QueryBuilder::remove().index("key").query()`; - let builder = QueryBuilder.remove().index("key").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().aliases("a").ids("b").query()`, () => { + let query = QueryBuilder.insert().aliases("a").ids("b").query(); + expect(query).toEqual(test_queries[1][1]); }); - it(`QueryBuilder::remove().ids(1).query()`, () => { - let query = `QueryBuilder::remove().ids(1).query()`; - let builder = QueryBuilder.remove().ids(1).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().aliases(vec!["a","b"]).ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.insert() + .aliases(["a", "b"]) + .ids([1, 2]) + .query(); + expect(query).toEqual(test_queries[2][1]); }); - it(`QueryBuilder::search().to(1).where_().node().query()`, () => { - let query = `QueryBuilder::search().to(1).where_().node().query()`; - let builder = QueryBuilder.search().to(1).where().node().query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().edges().from(1).to(2).query()`, () => { + let query = QueryBuilder.insert().edges().from(1).to(2).query(); + expect(query).toEqual(test_queries[3][1]); }); - it(`QueryBuilder::select().node_count().query()`, () => { - let query = `QueryBuilder::select().node_count().query()`; - let builder = QueryBuilder.select().node_count().query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().edges().from("a").to("b").query()`, () => { + let query = QueryBuilder.insert().edges().from("a").to("b").query(); + expect(query).toEqual(test_queries[4][1]); }); - it(`QueryBuilder::search().index("age").value(20).query()`, () => { - let query = `QueryBuilder::search().index("age").value(20).query()`; - let builder = QueryBuilder.search().index("age").value(20).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().edges().from("a").to(vec![1,2]).query()`, () => { + let query = QueryBuilder.insert().edges().from("a").to([1, 2]).query(); + expect(query).toEqual(test_queries[5][1]); }); - it(`QueryBuilder::insert().element(&T::default()).query()`, () => { - let query = `QueryBuilder::insert().element(&T::default()).query()`; - let builder = QueryBuilder.insert().element(new T()).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from([1, 2]) + .to([2, 3]) + .query(); + expect(query).toEqual(test_queries[6][1]); }); - it(`QueryBuilder::search().breadth_first().from("a").query()`, () => { - let query = `QueryBuilder::search().breadth_first().from("a").query()`; - let builder = QueryBuilder.search().breadth_first().from("a").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from([1, 2]) + .to([2, 3]) + .each() + .query(); + expect(query).toEqual(test_queries[7][1]); }); - it(`QueryBuilder::insert().nodes().aliases(vec!["a","b"]).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { - let query = `QueryBuilder::insert().nodes().aliases(vec!["a","b"]).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`; - let builder = QueryBuilder.insert() - .nodes() - .aliases(["a", "b"]) + it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from([1, 2]) + .to([2, 3]) + .each() .values([[["k", 1]], [["k", 2]]]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[8][1]); }); - it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).offset(10).limit(5).query()`, () => { - let query = `QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).offset(10).limit(5).query()`; - let builder = QueryBuilder.search() - .from(1) - .order_by([DbKeyOrder.Desc("k")]) - .offset(10) - .limit(5) + it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values_uniform(vec![("k",1).into(),("k",2).into()]).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from([1, 2]) + .to([2, 3]) + .each() + .values_uniform([ + ["k", 1], + ["k", 2], + ]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[9][1]); }); - it(`QueryBuilder::search().from(1).where_().not().keys(vec!["k1".into(),"k2".into()]).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().not().keys(vec!["k1".into(),"k2".into()]).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .not() - .keys(["k1", "k2"]) + it(`QueryBuilder::insert().edges().from("a").to(vec![1,2]).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from("a") + .to([1, 2]) + .values([[["k", 1]], [["k", 2]]]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[10][1]); }); - it(`QueryBuilder::search().from(1).where_().key("k").value(Comparison::Equal(1.into())).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().key("k").value(Comparison::Equal(1.into())).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .key("k") - .value(Comparison.Equal(1)) + it(`QueryBuilder::insert().edges().from("a").to(vec![1,2]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from("a") + .to([1, 2]) + .values_uniform([ + ["k", "v"], + [1, 10], + ]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[11][1]); }); - it(`QueryBuilder::insert().nodes().ids(vec![1,2]).values(vec![vec![("k","v").into()],vec![(1,10).into()]]).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids(vec![1,2]).values(vec![vec![("k","v").into()],vec![(1,10).into()]]).query()`; - let builder = QueryBuilder.insert() - .nodes() - .ids([1, 2]) - .values([[["k", "v"]], [[1, 10]]]) + it(`QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from(QueryBuilder.search().from("a").where().node().query()) + .to(QueryBuilder.search().from("b").where().node().query()) .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::insert().nodes().ids(1).count(1).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids(1).count(1).query()`; - let builder = QueryBuilder.insert().nodes().ids(1).count(1).query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[12][1]); }); - it(`QueryBuilder::search().depth_first().from("a").query()`, () => { - let query = `QueryBuilder::search().depth_first().from("a").query()`; - let builder = QueryBuilder.search().depth_first().from("a").query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::search().from(1).where_().beyond().keys(vec!["k".into()]).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().beyond().keys(vec!["k".into()]).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .beyond() - .keys(["k"]) + it(`QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .from(QueryBuilder.search().from("a").where().node().query()) + .to(QueryBuilder.search().from("b").where().node().query()) + .values([[["k", 1]], [["k", 2]]]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[13][1]); }); - it(`QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { - let query = `QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`; - let builder = QueryBuilder.insert() + it(`QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { + let query = QueryBuilder.insert() .edges() .from(QueryBuilder.search().from("a").where().node().query()) .to(QueryBuilder.search().from("b").where().node().query()) - .values([[["k", 1]], [["k", 2]]]) + .values_uniform([ + ["k", "v"], + [1, 10], + ]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[14][1]); }); - it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).offset(10).query()`, () => { - let query = `QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).offset(10).query()`; - let builder = QueryBuilder.search() + it(`QueryBuilder::insert().edges().ids(-3).from(1).to(2).query()`, () => { + let query = QueryBuilder.insert().edges().ids(-3).from(1).to(2).query(); + expect(query).toEqual(test_queries[15][1]); + }); + + it(`QueryBuilder::insert().edges().ids(vec![-3,-4]).from(1).to(2).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .ids([-3, -4]) .from(1) - .order_by([DbKeyOrder.Desc("k")]) - .offset(10) + .to(2) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[16][1]); }); - it(`QueryBuilder::search().from(1).where_().node().or().edge().query()`, () => { - let query = `QueryBuilder::search().from(1).where_().node().or().edge().query()`; - let builder = QueryBuilder.search() + it(`QueryBuilder::insert().edges().ids(QueryBuilder::search().from(1).where_().edge().query()).from(1).to(2).query()`, () => { + let query = QueryBuilder.insert() + .edges() + .ids(QueryBuilder.search().from(1).where().edge().query()) .from(1) - .where() - .node() - .or() - .edge() + .to(2) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[17][1]); }); it(`QueryBuilder::insert().index("key").query()`, () => { - let query = `QueryBuilder::insert().index("key").query()`; - let builder = QueryBuilder.insert().index("key").query(); - expect(builder).toEqual(test_queries[query]); + let query = QueryBuilder.insert().index("key").query(); + expect(query).toEqual(test_queries[18][1]); }); - it(`QueryBuilder::remove().aliases("a").query()`, () => { - let query = `QueryBuilder::remove().aliases("a").query()`; - let builder = QueryBuilder.remove().aliases("a").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().nodes().count(2).query()`, () => { + let query = QueryBuilder.insert().nodes().count(2).query(); + expect(query).toEqual(test_queries[19][1]); }); - it(`QueryBuilder::insert().aliases(vec!["a","b"]).ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::insert().aliases(vec!["a","b"]).ids(vec![1,2]).query()`; - let builder = QueryBuilder.insert() - .aliases(["a", "b"]) - .ids([1, 2]) + it(`QueryBuilder::insert().nodes().count(2).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { + let query = QueryBuilder.insert() + .nodes() + .count(2) + .values_uniform([ + ["k", "v"], + [1, 10], + ]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[20][1]); }); - it(`QueryBuilder::search().from(1).offset(10).query()`, () => { - let query = `QueryBuilder::search().from(1).offset(10).query()`; - let builder = QueryBuilder.search().from(1).offset(10).query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::insert().edges().from(1).to(2).query()`, () => { - let query = `QueryBuilder::insert().edges().from(1).to(2).query()`; - let builder = QueryBuilder.insert().edges().from(1).to(2).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().nodes().aliases(vec!["a","b"]).query()`, () => { + let query = QueryBuilder.insert().nodes().aliases(["a", "b"]).query(); + expect(query).toEqual(test_queries[21][1]); }); - it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).query()`, () => { - let query = `QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from([1, 2]) - .to([2, 3]) + it(`QueryBuilder::insert().nodes().aliases(vec!["a","b"]).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { + let query = QueryBuilder.insert() + .nodes() + .aliases(["a", "b"]) + .values([[["k", 1]], [["k", 2]]]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[22][1]); }); - it(`QueryBuilder::insert().edges().from("a").to(vec![1,2]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { - let query = `QueryBuilder::insert().edges().from("a").to(vec![1,2]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from("a") - .to([1, 2]) + it(`QueryBuilder::insert().nodes().aliases(vec!["a","b"]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { + let query = QueryBuilder.insert() + .nodes() + .aliases(["a", "b"]) .values_uniform([ ["k", "v"], [1, 10], ]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[23][1]); }); - it(`QueryBuilder::insert().nodes().ids(vec!["a","b"]).count(1).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids(vec!["a","b"]).count(1).query()`; - let builder = QueryBuilder.insert() - .nodes() - .ids(["a", "b"]) - .count(1) - .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::insert().nodes().ids(vec![1,2]).count(1).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids(vec![1,2]).count(1).query()`; - let builder = QueryBuilder.insert() + it(`QueryBuilder::insert().nodes().values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { + let query = QueryBuilder.insert() .nodes() - .ids([1, 2]) - .count(1) - .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::insert().elements(&[T::default(),T::default()]).query()`, () => { - let query = `QueryBuilder::insert().elements(&[T::default(),T::default()]).query()`; - let builder = QueryBuilder.insert() - .elements([new T(), new T()]) + .values([[["k", 1]], [["k", 2]]]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[24][1]); }); - it(`QueryBuilder::select().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().nodes().ids(1).count(1).query()`, () => { + let query = QueryBuilder.insert().nodes().ids(1).count(1).query(); + expect(query).toEqual(test_queries[25][1]); }); - it(`QueryBuilder::insert().edges().ids(vec![-3,-4]).from(1).to(2).query()`, () => { - let query = `QueryBuilder::insert().edges().ids(vec![-3,-4]).from(1).to(2).query()`; - let builder = QueryBuilder.insert() - .edges() - .ids([-3, -4]) - .from(1) - .to(2) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().nodes().ids(vec![1,2]).count(1).query()`, () => { + let query = QueryBuilder.insert().nodes().ids([1, 2]).count(1).query(); + expect(query).toEqual(test_queries[26][1]); }); it(`QueryBuilder::insert().nodes().ids("a").count(1).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids("a").count(1).query()`; - let builder = QueryBuilder.insert().nodes().ids("a").count(1).query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::insert().nodes().values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { - let query = `QueryBuilder::insert().nodes().values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`; - let builder = QueryBuilder.insert() - .nodes() - .values([[["k", 1]], [["k", 2]]]) - .query(); - expect(builder).toEqual(test_queries[query]); + let query = QueryBuilder.insert().nodes().ids("a").count(1).query(); + expect(query).toEqual(test_queries[27][1]); }); - it(`QueryBuilder::insert().edges().ids(-3).from(1).to(2).query()`, () => { - let query = `QueryBuilder::insert().edges().ids(-3).from(1).to(2).query()`; - let builder = QueryBuilder.insert() - .edges() - .ids(-3) - .from(1) - .to(2) - .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::select().aliases().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().aliases().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select().aliases().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().nodes().ids("a").aliases("a").query()`, () => { + let query = QueryBuilder.insert().nodes().ids("a").aliases("a").query(); + expect(query).toEqual(test_queries[28][1]); }); - it(`QueryBuilder::insert().nodes().ids(QueryBuilder::search().from(1).query()).count(1).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids(QueryBuilder::search().from(1).query()).count(1).query()`; - let builder = QueryBuilder.insert() + it(`QueryBuilder::insert().nodes().ids(vec!["a","b"]).count(1).query()`, () => { + let query = QueryBuilder.insert() .nodes() - .ids(QueryBuilder.search().from(1).query()) + .ids(["a", "b"]) .count(1) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[29][1]); }); - it(`QueryBuilder::select().aliases().ids(QueryBuilder::search().from(1).query()).query()`, () => { - let query = `QueryBuilder::select().aliases().ids(QueryBuilder::search().from(1).query()).query()`; - let builder = QueryBuilder.select() - .aliases() - .ids(QueryBuilder.search().from(1).query()) - .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::search().from(1).where_().distance(CountComparison::LessThan(3)).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().distance(CountComparison::LessThan(3)).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .distance(CountComparison.LessThan(3)) + it(`QueryBuilder::insert().nodes().ids(vec![1,2]).values(vec![vec![("k","v").into()],vec![(1,10).into()]]).query()`, () => { + let query = QueryBuilder.insert() + .nodes() + .ids([1, 2]) + .values([[["k", "v"]], [[1, 10]]]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[30][1]); }); - it(`QueryBuilder::search().from(1).where_().not_beyond().ids("a").query()`, () => { - let query = `QueryBuilder::search().from(1).where_().not_beyond().ids("a").query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .not_beyond() - .ids("a") + it(`QueryBuilder::insert().nodes().ids(vec![1,2]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { + let query = QueryBuilder.insert() + .nodes() + .ids([1, 2]) + .values_uniform([ + ["k", "v"], + [1, 10], + ]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[31][1]); }); - it(`QueryBuilder::remove().ids("a").query()`, () => { - let query = `QueryBuilder::remove().ids("a").query()`; - let builder = QueryBuilder.remove().ids("a").query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::remove().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::remove().ids(vec![1,2]).query()`; - let builder = QueryBuilder.remove().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::select().keys().ids(QueryBuilder::search().from(1).query()).query()`, () => { - let query = `QueryBuilder::select().keys().ids(QueryBuilder::search().from(1).query()).query()`; - let builder = QueryBuilder.select() - .keys() + it(`QueryBuilder::insert().nodes().ids(QueryBuilder::search().from(1).query()).count(1).query()`, () => { + let query = QueryBuilder.insert() + .nodes() .ids(QueryBuilder.search().from(1).query()) + .count(1) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[32][1]); }); - it(`QueryBuilder::insert().edges().from("a").to(vec![1,2]).query()`, () => { - let query = `QueryBuilder::insert().edges().from("a").to(vec![1,2]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from("a") - .to([1, 2]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().element(&T::default()).query()`, () => { + let query = QueryBuilder.insert().element(new T()).query(); + expect(query).toEqual(test_queries[33][1]); }); - it(`QueryBuilder::search().to(1).query()`, () => { - let query = `QueryBuilder::search().to(1).query()`; - let builder = QueryBuilder.search().to(1).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().elements(&[T::default(),T::default()]).query()`, () => { + let query = QueryBuilder.insert().elements([new T(), new T()]).query(); + expect(query).toEqual(test_queries[34][1]); }); - it(`QueryBuilder::search().from(1).where_().edge_count(CountComparison::GreaterThan(2)).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().edge_count(CountComparison::GreaterThan(2)).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .edge_count(CountComparison.GreaterThan(2)) + it(`QueryBuilder::insert().values(vec![vec![("k","v").into(),(1,10).into()],vec![("k",2).into()]]).ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.insert() + .values([ + [ + ["k", "v"], + [1, 10], + ], + [["k", 2]], + ]) + .ids([1, 2]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[35][1]); }); it(`QueryBuilder::insert().values(vec![vec![("k","v").into(),(1,10).into()],vec![("k",2).into()]]).ids(QueryBuilder::search().from("a").query()).query()`, () => { - let query = `QueryBuilder::insert().values(vec![vec![("k","v").into(),(1,10).into()],vec![("k",2).into()]]).ids(QueryBuilder::search().from("a").query()).query()`; - let builder = QueryBuilder.insert() + let query = QueryBuilder.insert() .values([ [ ["k", "v"], @@ -425,470 +325,431 @@ describe("query tests", () => { ]) .ids(QueryBuilder.search().from("a").query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[36][1]); }); - it(`QueryBuilder::select().key_count().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().key_count().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select().key_count().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::insert().values_uniform(vec![("k","v").into(),(1,10).into()]).ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.insert() + .values_uniform([ + ["k", "v"], + [1, 10], + ]) + .ids([1, 2]) + .query(); + expect(query).toEqual(test_queries[37][1]); }); - it(`QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Equal(1.into())).end_where().query()`, () => { - let query = `QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Equal(1.into())).end_where().query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .node() - .or() - .where() - .edge() - .and() - .key("k") - .value(Comparison.Equal(1)) - .end_where() + it(`QueryBuilder::insert().values_uniform(vec![("k","v").into(),(1,10).into()]).ids(QueryBuilder::search().from("a").query()).query()`, () => { + let query = QueryBuilder.insert() + .values_uniform([ + ["k", "v"], + [1, 10], + ]) + .ids(QueryBuilder.search().from("a").query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[38][1]); }); - it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Asc("k".into())]).where_().node().query()`, () => { - let query = `QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Asc("k".into())]).where_().node().query()`; - let builder = QueryBuilder.search() - .from(1) - .order_by([DbKeyOrder.Asc("k")]) - .where() - .node() - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::remove().aliases("a").query()`, () => { + let query = QueryBuilder.remove().aliases("a").query(); + expect(query).toEqual(test_queries[39][1]); }); - it(`QueryBuilder::search().to(1).offset(1).query()`, () => { - let query = `QueryBuilder::search().to(1).offset(1).query()`; - let builder = QueryBuilder.search().to(1).offset(1).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::remove().aliases(vec!["a","b"]).query()`, () => { + let query = QueryBuilder.remove().aliases(["a", "b"]).query(); + expect(query).toEqual(test_queries[40][1]); }); - it(`QueryBuilder::search().from(1).limit(1).where_().node().query()`, () => { - let query = `QueryBuilder::search().from(1).limit(1).where_().node().query()`; - let builder = QueryBuilder.search() - .from(1) - .limit(1) - .where() - .node() - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::remove().ids(1).query()`, () => { + let query = QueryBuilder.remove().ids(1).query(); + expect(query).toEqual(test_queries[41][1]); }); - it(`QueryBuilder::search().to(1).limit(1).query()`, () => { - let query = `QueryBuilder::search().to(1).limit(1).query()`; - let builder = QueryBuilder.search().to(1).limit(1).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::remove().ids("a").query()`, () => { + let query = QueryBuilder.remove().ids("a").query(); + expect(query).toEqual(test_queries[42][1]); }); - it(`QueryBuilder::insert().nodes().aliases(vec!["a","b"]).query()`, () => { - let query = `QueryBuilder::insert().nodes().aliases(vec!["a","b"]).query()`; - let builder = QueryBuilder.insert().nodes().aliases(["a", "b"]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::remove().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.remove().ids([1, 2]).query(); + expect(query).toEqual(test_queries[43][1]); }); - it(`QueryBuilder::search().from(1).where_().node().and().distance(CountComparison::GreaterThanOrEqual(3)).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().node().and().distance(CountComparison::GreaterThanOrEqual(3)).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .node() - .and() - .distance(CountComparison.GreaterThanOrEqual(3)) + it(`QueryBuilder::remove().ids(vec!["a","b"]).query()`, () => { + let query = QueryBuilder.remove().ids(["a", "b"]).query(); + expect(query).toEqual(test_queries[44][1]); + }); + + it(`QueryBuilder::remove().ids(QueryBuilder::search().from("a").query()).query()`, () => { + let query = QueryBuilder.remove() + .ids(QueryBuilder.search().from("a").query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[45][1]); }); - it(`QueryBuilder::select().keys().ids("a").query()`, () => { - let query = `QueryBuilder::select().keys().ids("a").query()`; - let builder = QueryBuilder.select().keys().ids("a").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::remove().index("key").query()`, () => { + let query = QueryBuilder.remove().index("key").query(); + expect(query).toEqual(test_queries[46][1]); }); - it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { - let query = `QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from([1, 2]) - .to([2, 3]) - .each() - .values([[["k", 1]], [["k", 2]]]) + it(`QueryBuilder::remove().values(vec!["k1".into(),"k2".into()]).ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.remove() + .values(["k1", "k2"]) + .ids([1, 2]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[47][1]); }); - it(`QueryBuilder::insert().values(vec![vec![("k","v").into(),(1,10).into()],vec![("k",2).into()]]).ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::insert().values(vec![vec![("k","v").into(),(1,10).into()],vec![("k",2).into()]]).ids(vec![1,2]).query()`; - let builder = QueryBuilder.insert() - .values([ - [ - ["k", "v"], - [1, 10], - ], - [["k", 2]], - ]) - .ids([1, 2]) + it(`QueryBuilder::remove().values(vec!["k1".into(),"k2".into()]).ids(QueryBuilder::search().from("a").query()).query()`, () => { + let query = QueryBuilder.remove() + .values(["k1", "k2"]) + .ids(QueryBuilder.search().from("a").query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[48][1]); }); - it(`QueryBuilder::insert().aliases("a").ids(1).query()`, () => { - let query = `QueryBuilder::insert().aliases("a").ids(1).query()`; - let builder = QueryBuilder.insert().aliases("a").ids(1).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().aliases().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().aliases().ids([1, 2]).query(); + expect(query).toEqual(test_queries[49][1]); }); - it(`QueryBuilder::select().edge_count_from().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().edge_count_from().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select() - .edge_count_from() - .ids([1, 2]) + it(`QueryBuilder::select().aliases().ids(QueryBuilder::search().from(1).query()).query()`, () => { + let query = QueryBuilder.select() + .aliases() + .ids(QueryBuilder.search().from(1).query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[50][1]); }); - it(`QueryBuilder::insert().aliases("a").ids("b").query()`, () => { - let query = `QueryBuilder::insert().aliases("a").ids("b").query()`; - let builder = QueryBuilder.insert().aliases("a").ids("b").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().aliases().query()`, () => { + let query = QueryBuilder.select().aliases().query(); + expect(query).toEqual(test_queries[51][1]); }); - it(`QueryBuilder::remove().aliases(vec!["a","b"]).query()`, () => { - let query = `QueryBuilder::remove().aliases(vec!["a","b"]).query()`; - let builder = QueryBuilder.remove().aliases(["a", "b"]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().edge_count().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().edge_count().ids([1, 2]).query(); + expect(query).toEqual(test_queries[52][1]); }); - it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("age".into()),DbKeyOrder::Asc("name".into())]).query()`, () => { - let query = `QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("age".into()),DbKeyOrder::Asc("name".into())]).query()`; - let builder = QueryBuilder.search() - .from(1) - .order_by([DbKeyOrder.Desc("age"), DbKeyOrder.Asc("name")]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().edge_count_from().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().edge_count_from().ids([1, 2]).query(); + expect(query).toEqual(test_queries[53][1]); }); - it(`QueryBuilder::select().keys().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().keys().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select().keys().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().edge_count_to().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().edge_count_to().ids([1, 2]).query(); + expect(query).toEqual(test_queries[54][1]); }); - it(`QueryBuilder::search().from("a").query()`, () => { - let query = `QueryBuilder::search().from("a").query()`; - let builder = QueryBuilder.search().from("a").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().ids("a").query()`, () => { + let query = QueryBuilder.select().ids("a").query(); + expect(query).toEqual(test_queries[55][1]); }); - it(`QueryBuilder::select().key_count().ids("a").query()`, () => { - let query = `QueryBuilder::select().key_count().ids("a").query()`; - let builder = QueryBuilder.select().key_count().ids("a").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().ids([1, 2]).query(); + expect(query).toEqual(test_queries[56][1]); }); - it(`QueryBuilder::search().from(1).where_().keys(vec!["k1".into(),"k2".into()]).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().keys(vec!["k1".into(),"k2".into()]).query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .keys(["k1", "k2"]) + it(`QueryBuilder::select().ids(QueryBuilder::search().from(1).query()).query()`, () => { + let query = QueryBuilder.select() + .ids(QueryBuilder.search().from(1).query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[57][1]); }); - it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values_uniform(vec![("k",1).into(),("k",2).into()]).query()`, () => { - let query = `QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values_uniform(vec![("k",1).into(),("k",2).into()]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from([1, 2]) - .to([2, 3]) - .each() - .values_uniform([ - ["k", 1], - ["k", 2], - ]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().indexes().query()`, () => { + let query = QueryBuilder.select().indexes().query(); + expect(query).toEqual(test_queries[58][1]); }); - it(`QueryBuilder::select().edge_count_to().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().edge_count_to().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select().edge_count_to().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().keys().ids("a").query()`, () => { + let query = QueryBuilder.select().keys().ids("a").query(); + expect(query).toEqual(test_queries[59][1]); }); - it(`QueryBuilder::insert().edges().from("a").to(vec![1,2]).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`, () => { - let query = `QueryBuilder::insert().edges().from("a").to(vec![1,2]).values(vec![vec![("k",1).into()],vec![("k",2).into()]]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from("a") - .to([1, 2]) - .values([[["k", 1]], [["k", 2]]]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().keys().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().keys().ids([1, 2]).query(); + expect(query).toEqual(test_queries[60][1]); }); - it(`QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Contains(1.into())).end_where().query()`, () => { - let query = `QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Contains(1.into())).end_where().query()`; - let builder = QueryBuilder.search() - .from(1) - .where() - .node() - .or() - .where() - .edge() - .and() - .key("k") - .value(Comparison.Contains(1)) - .end_where() + it(`QueryBuilder::select().keys().ids(QueryBuilder::search().from(1).query()).query()`, () => { + let query = QueryBuilder.select() + .keys() + .ids(QueryBuilder.search().from(1).query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[61][1]); }); - it(`QueryBuilder::search().elements().query()`, () => { - let query = `QueryBuilder::search().elements().query()`; - let builder = QueryBuilder.search().elements().query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().key_count().ids("a").query()`, () => { + let query = QueryBuilder.select().key_count().ids("a").query(); + expect(query).toEqual(test_queries[62][1]); }); - it(`QueryBuilder::select().ids("a").query()`, () => { - let query = `QueryBuilder::select().ids("a").query()`; - let builder = QueryBuilder.select().ids("a").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().key_count().ids(vec![1,2]).query()`, () => { + let query = QueryBuilder.select().key_count().ids([1, 2]).query(); + expect(query).toEqual(test_queries[63][1]); }); it(`QueryBuilder::select().key_count().ids(QueryBuilder::search().from(1).query()).query()`, () => { - let query = `QueryBuilder::select().key_count().ids(QueryBuilder::search().from(1).query()).query()`; - let builder = QueryBuilder.select() + let query = QueryBuilder.select() .key_count() .ids(QueryBuilder.search().from(1).query()) .query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::search().from(1).limit(5).query()`, () => { - let query = `QueryBuilder::search().from(1).limit(5).query()`; - let builder = QueryBuilder.search().from(1).limit(5).query(); - expect(builder).toEqual(test_queries[query]); - }); - - it(`QueryBuilder::insert().edges().ids(QueryBuilder::search().from(1).where_().edge().query()).from(1).to(2).query()`, () => { - let query = `QueryBuilder::insert().edges().ids(QueryBuilder::search().from(1).where_().edge().query()).from(1).to(2).query()`; - let builder = QueryBuilder.insert() - .edges() - .ids(QueryBuilder.search().from(1).where().edge().query()) - .from(1) - .to(2) - .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[64][1]); }); - it(`QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).query()`, () => { - let query = `QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).query()`; - let builder = QueryBuilder.insert() - .edges() - .from(QueryBuilder.search().from("a").where().node().query()) - .to(QueryBuilder.search().from("b").where().node().query()) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().node_count().query()`, () => { + let query = QueryBuilder.select().node_count().query(); + expect(query).toEqual(test_queries[65][1]); }); - it(`QueryBuilder::insert().nodes().count(2).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { - let query = `QueryBuilder::insert().nodes().count(2).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`; - let builder = QueryBuilder.insert() - .nodes() - .count(2) - .values_uniform([ - ["k", "v"], - [1, 10], - ]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids("a").query()`, () => { + let query = QueryBuilder.select().values(["k", "k2"]).ids("a").query(); + expect(query).toEqual(test_queries[66][1]); }); it(`QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids(vec![1,2]).query()`; - let builder = QueryBuilder.select() + let query = QueryBuilder.select() .values(["k", "k2"]) .ids([1, 2]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[67][1]); }); - it(`QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { - let query = `QueryBuilder::insert().edges().from(QueryBuilder::search().from("a").where_().node().query()).to(QueryBuilder::search().from("b").where_().node().query()).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`; - let builder = QueryBuilder.insert() - .edges() - .from(QueryBuilder.search().from("a").where().node().query()) - .to(QueryBuilder.search().from("b").where().node().query()) - .values_uniform([ - ["k", "v"], - [1, 10], - ]) + it(`QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids(QueryBuilder::search().from(1).query()).query()`, () => { + let query = QueryBuilder.select() + .values(["k", "k2"]) + .ids(QueryBuilder.search().from(1).query()) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[68][1]); }); - it(`QueryBuilder::insert().nodes().ids("a").aliases("a").query()`, () => { - let query = `QueryBuilder::insert().nodes().ids("a").aliases("a").query()`; - let builder = QueryBuilder.insert() - .nodes() - .ids("a") - .aliases("a") - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from("a").query()`, () => { + let query = QueryBuilder.search().from("a").query(); + expect(query).toEqual(test_queries[69][1]); }); - it(`QueryBuilder::insert().values_uniform(vec![("k","v").into(),(1,10).into()]).ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::insert().values_uniform(vec![("k","v").into(),(1,10).into()]).ids(vec![1,2]).query()`; - let builder = QueryBuilder.insert() - .values_uniform([ - ["k", "v"], - [1, 10], - ]) - .ids([1, 2]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().to(1).query()`, () => { + let query = QueryBuilder.search().to(1).query(); + expect(query).toEqual(test_queries[70][1]); }); - it(`QueryBuilder::remove().ids(vec!["a","b"]).query()`, () => { - let query = `QueryBuilder::remove().ids(vec!["a","b"]).query()`; - let builder = QueryBuilder.remove().ids(["a", "b"]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from("a").to("b").query()`, () => { + let query = QueryBuilder.search().from("a").to("b").query(); + expect(query).toEqual(test_queries[71][1]); }); - it(`QueryBuilder::remove().ids(QueryBuilder::search().from("a").query()).query()`, () => { - let query = `QueryBuilder::remove().ids(QueryBuilder::search().from("a").query()).query()`; - let builder = QueryBuilder.remove() - .ids(QueryBuilder.search().from("a").query()) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().breadth_first().from("a").query()`, () => { + let query = QueryBuilder.search().breadth_first().from("a").query(); + expect(query).toEqual(test_queries[72][1]); }); - it(`QueryBuilder::remove().values(vec!["k1".into(),"k2".into()]).ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::remove().values(vec!["k1".into(),"k2".into()]).ids(vec![1,2]).query()`; - let builder = QueryBuilder.remove() - .values(["k1", "k2"]) - .ids([1, 2]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().depth_first().to(1).query()`, () => { + let query = QueryBuilder.search().depth_first().to(1).query(); + expect(query).toEqual(test_queries[73][1]); }); - it(`QueryBuilder::select().ids(QueryBuilder::search().from(1).query()).query()`, () => { - let query = `QueryBuilder::select().ids(QueryBuilder::search().from(1).query()).query()`; - let builder = QueryBuilder.select() - .ids(QueryBuilder.search().from(1).query()) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().depth_first().from("a").query()`, () => { + let query = QueryBuilder.search().depth_first().from("a").query(); + expect(query).toEqual(test_queries[74][1]); }); - it(`QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids("a").query()`, () => { - let query = `QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids("a").query()`; - let builder = QueryBuilder.select() - .values(["k", "k2"]) - .ids("a") - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().elements().query()`, () => { + let query = QueryBuilder.search().elements().query(); + expect(query).toEqual(test_queries[75][1]); }); - it(`QueryBuilder::remove().values(vec!["k1".into(),"k2".into()]).ids(QueryBuilder::search().from("a").query()).query()`, () => { - let query = `QueryBuilder::remove().values(vec!["k1".into(),"k2".into()]).ids(QueryBuilder::search().from("a").query()).query()`; - let builder = QueryBuilder.remove() - .values(["k1", "k2"]) - .ids(QueryBuilder.search().from("a").query()) + it(`QueryBuilder::search().index("age").value(20).query()`, () => { + let query = QueryBuilder.search().index("age").value(20).query(); + expect(query).toEqual(test_queries[76][1]); + }); + + it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("age".into()),DbKeyOrder::Asc("name".into())]).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .order_by([DbKeyOrder.Desc("age"), DbKeyOrder.Asc("name")]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[77][1]); }); - it(`QueryBuilder::select().edge_count().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::select().edge_count().ids(vec![1,2]).query()`; - let builder = QueryBuilder.select().edge_count().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).offset(10).query()`, () => { + let query = QueryBuilder.search().from(1).offset(10).query(); + expect(query).toEqual(test_queries[78][1]); }); - it(`QueryBuilder::select().aliases().query()`, () => { - let query = `QueryBuilder::select().aliases().query()`; - let builder = QueryBuilder.select().aliases().query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).limit(5).query()`, () => { + let query = QueryBuilder.search().from(1).limit(5).query(); + expect(query).toEqual(test_queries[79][1]); }); - it(`QueryBuilder::search().from("a").to("b").query()`, () => { - let query = `QueryBuilder::search().from("a").to("b").query()`; - let builder = QueryBuilder.search().from("a").to("b").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).offset(10).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .order_by([DbKeyOrder.Desc("k")]) + .offset(10) + .query(); + expect(query).toEqual(test_queries[80][1]); }); it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).limit(5).query()`, () => { - let query = `QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).limit(5).query()`; - let builder = QueryBuilder.search() + let query = QueryBuilder.search() .from(1) .order_by([DbKeyOrder.Desc("k")]) .limit(5) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[81][1]); }); - it(`QueryBuilder::search().from(1).offset(10).limit(5).query()`, () => { - let query = `QueryBuilder::search().from(1).offset(10).limit(5).query()`; - let builder = QueryBuilder.search().from(1).offset(10).limit(5).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc("k".into())]).offset(10).limit(5).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .order_by([DbKeyOrder.Desc("k")]) + .offset(10) + .limit(5) + .query(); + expect(query).toEqual(test_queries[82][1]); }); - it(`QueryBuilder::insert().nodes().count(2).query()`, () => { - let query = `QueryBuilder::insert().nodes().count(2).query()`; - let builder = QueryBuilder.insert().nodes().count(2).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).offset(10).limit(5).query()`, () => { + let query = QueryBuilder.search().from(1).offset(10).limit(5).query(); + expect(query).toEqual(test_queries[83][1]); }); - it(`QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids(QueryBuilder::search().from(1).query()).query()`, () => { - let query = `QueryBuilder::select().values(vec!["k".into(),"k2".into()]).ids(QueryBuilder::search().from(1).query()).query()`; - let builder = QueryBuilder.select() - .values(["k", "k2"]) - .ids(QueryBuilder.search().from(1).query()) + it(`QueryBuilder::search().from(1).where_().distance(CountComparison::LessThan(3)).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .distance(CountComparison.LessThan(3)) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[84][1]); }); it(`QueryBuilder::search().from(1).where_().edge().query()`, () => { - let query = `QueryBuilder::search().from(1).where_().edge().query()`; - let builder = QueryBuilder.search().from(1).where().edge().query(); - expect(builder).toEqual(test_queries[query]); + let query = QueryBuilder.search().from(1).where().edge().query(); + expect(query).toEqual(test_queries[85][1]); + }); + + it(`QueryBuilder::search().from(1).where_().edge_count(CountComparison::GreaterThan(2)).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .edge_count(CountComparison.GreaterThan(2)) + .query(); + expect(query).toEqual(test_queries[86][1]); + }); + + it(`QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1)).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .edge_count_from(CountComparison.Equal(1)) + .query(); + expect(query).toEqual(test_queries[87][1]); }); it(`QueryBuilder::search().from(1).where_().edge_count_to(CountComparison::NotEqual(1)).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().edge_count_to(CountComparison::NotEqual(1)).query()`; - let builder = QueryBuilder.search() + let query = QueryBuilder.search() .from(1) .where() .edge_count_to(CountComparison.NotEqual(1)) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[88][1]); + }); + + it(`QueryBuilder::search().from(1).where_().node().query()`, () => { + let query = QueryBuilder.search().from(1).where().node().query(); + expect(query).toEqual(test_queries[89][1]); + }); + + it(`QueryBuilder::search().from(1).where_().key("k").value(Comparison::Equal(1.into())).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .key("k") + .value(Comparison.Equal(1)) + .query(); + expect(query).toEqual(test_queries[90][1]); + }); + + it(`QueryBuilder::search().from(1).where_().keys(vec!["k1".into(),"k2".into()]).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .keys(["k1", "k2"]) + .query(); + expect(query).toEqual(test_queries[91][1]); + }); + + it(`QueryBuilder::search().from(1).where_().not().keys(vec!["k1".into(),"k2".into()]).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .not() + .keys(["k1", "k2"]) + .query(); + expect(query).toEqual(test_queries[92][1]); }); it(`QueryBuilder::search().from(1).where_().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().ids(vec![1,2]).query()`; - let builder = QueryBuilder.search().from(1).where().ids([1, 2]).query(); - expect(builder).toEqual(test_queries[query]); + let query = QueryBuilder.search().from(1).where().ids([1, 2]).query(); + expect(query).toEqual(test_queries[93][1]); + }); + + it(`QueryBuilder::search().from(1).where_().beyond().keys(vec!["k".into()]).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .beyond() + .keys(["k"]) + .query(); + expect(query).toEqual(test_queries[94][1]); }); it(`QueryBuilder::search().from(1).where_().not().ids(vec![1,2]).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().not().ids(vec![1,2]).query()`; - let builder = QueryBuilder.search() + let query = QueryBuilder.search() .from(1) .where() .not() .ids([1, 2]) .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[95][1]); }); - it(`QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Contains((vec![1,2]).into())).end_where().query()`, () => { - let query = `QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Contains((vec![1,2]).into())).end_where().query()`; - let builder = QueryBuilder.search() + it(`QueryBuilder::search().from(1).where_().not_beyond().ids("a").query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .not_beyond() + .ids("a") + .query(); + expect(query).toEqual(test_queries[96][1]); + }); + + it(`QueryBuilder::search().from(1).where_().node().or().edge().query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .node() + .or() + .edge() + .query(); + expect(query).toEqual(test_queries[97][1]); + }); + + it(`QueryBuilder::search().from(1).where_().node().and().distance(CountComparison::GreaterThanOrEqual(3)).query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .node() + .and() + .distance(CountComparison.GreaterThanOrEqual(3)) + .query(); + expect(query).toEqual(test_queries[98][1]); + }); + + it(`QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Equal(1.into())).end_where().query()`, () => { + let query = QueryBuilder.search() .from(1) .where() .node() @@ -897,91 +758,96 @@ describe("query tests", () => { .edge() .and() .key("k") - .value(Comparison.Contains([1, 2])) + .value(Comparison.Equal(1)) .end_where() .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[99][1]); }); - it(`QueryBuilder::search().from(1).offset(1).where_().node().query()`, () => { - let query = `QueryBuilder::search().from(1).offset(1).where_().node().query()`; - let builder = QueryBuilder.search() + it(`QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Contains(1.into())).end_where().query()`, () => { + let query = QueryBuilder.search() .from(1) - .offset(1) .where() .node() + .or() + .where() + .edge() + .and() + .key("k") + .value(Comparison.Contains(1)) + .end_where() .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[100][1]); }); - it(`QueryBuilder::insert().nodes().aliases(vec!["a","b"]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { - let query = `QueryBuilder::insert().nodes().aliases(vec!["a","b"]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`; - let builder = QueryBuilder.insert() - .nodes() - .aliases(["a", "b"]) - .values_uniform([ - ["k", "v"], - [1, 10], - ]) + it(`QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key("k").value(Comparison::Contains((vec![1,2]).into())).end_where().query()`, () => { + let query = QueryBuilder.search() + .from(1) + .where() + .node() + .or() + .where() + .edge() + .and() + .key("k") + .value(Comparison.Contains([1, 2])) + .end_where() .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[101][1]); }); - it(`QueryBuilder::insert().edges().from("a").to("b").query()`, () => { - let query = `QueryBuilder::insert().edges().from("a").to("b").query()`; - let builder = QueryBuilder.insert().edges().from("a").to("b").query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Asc("k".into())]).where_().node().query()`, () => { + let query = QueryBuilder.search() + .from(1) + .order_by([DbKeyOrder.Asc("k")]) + .where() + .node() + .query(); + expect(query).toEqual(test_queries[102][1]); }); - it(`QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1)).query()`, () => { - let query = `QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1)).query()`; - let builder = QueryBuilder.search() + it(`QueryBuilder::search().from(1).limit(1).where_().node().query()`, () => { + let query = QueryBuilder.search() .from(1) + .limit(1) .where() - .edge_count_from(CountComparison.Equal(1)) + .node() .query(); - expect(builder).toEqual(test_queries[query]); + expect(query).toEqual(test_queries[103][1]); }); - it(`QueryBuilder::search().from(1).where_().node().query()`, () => { - let query = `QueryBuilder::search().from(1).where_().node().query()`; - let builder = QueryBuilder.search().from(1).where().node().query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().from(1).offset(1).where_().node().query()`, () => { + let query = QueryBuilder.search() + .from(1) + .offset(1) + .where() + .node() + .query(); + expect(query).toEqual(test_queries[104][1]); }); - it(`QueryBuilder::insert().nodes().ids(vec![1,2]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`, () => { - let query = `QueryBuilder::insert().nodes().ids(vec![1,2]).values_uniform(vec![("k","v").into(),(1,10).into()]).query()`; - let builder = QueryBuilder.insert() - .nodes() - .ids([1, 2]) - .values_uniform([ - ["k", "v"], - [1, 10], - ]) - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().to(1).offset(1).query()`, () => { + let query = QueryBuilder.search().to(1).offset(1).query(); + expect(query).toEqual(test_queries[105][1]); }); - it(`QueryBuilder::search().depth_first().to(1).query()`, () => { - let query = `QueryBuilder::search().depth_first().to(1).query()`; - let builder = QueryBuilder.search().depth_first().to(1).query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().to(1).limit(1).query()`, () => { + let query = QueryBuilder.search().to(1).limit(1).query(); + expect(query).toEqual(test_queries[106][1]); }); - it(`QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().query()`, () => { - let query = `QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().query()`; - let builder = QueryBuilder.insert() - .edges() - .from([1, 2]) - .to([2, 3]) - .each() - .query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().to(1).where_().node().query()`, () => { + let query = QueryBuilder.search().to(1).where().node().query(); + expect(query).toEqual(test_queries[107][1]); }); - it(`QueryBuilder::select().indexes().query()`, () => { - let query = `QueryBuilder::select().indexes().query()`; - let builder = QueryBuilder.select().indexes().query(); - expect(builder).toEqual(test_queries[query]); + it(`QueryBuilder::search().to(1).order_by(vec![DbKeyOrder::Asc("k".into())]).where_().node().query()`, () => { + let query = QueryBuilder.search() + .to(1) + .order_by([DbKeyOrder.Asc("k")]) + .where() + .node() + .query(); + expect(query).toEqual(test_queries[108][1]); }); }); diff --git a/agdb_server/openapi/test_queries.json b/agdb_server/openapi/test_queries.json index 10377766..a6620c49 100644 --- a/agdb_server/openapi/test_queries.json +++ b/agdb_server/openapi/test_queries.json @@ -1,231 +1,306 @@ -{ - "QueryBuilder::search().to(1).where_().node().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 1 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] +[ + [ + "QueryBuilder::insert().aliases(\"a\").ids(1).query()", + { + "InsertAlias": { + "ids": { + "Ids": [ + { + "Id": 1 + } + ] + }, + "aliases": [ + "a" + ] + } } - }, - "QueryBuilder::search().from(1).where_().not().ids(vec![1,2]).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "Not", - "data": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - } - } - ] + ], + [ + "QueryBuilder::insert().aliases(\"a\").ids(\"b\").query()", + { + "InsertAlias": { + "ids": { + "Ids": [ + { + "Alias": "b" + } + ] + }, + "aliases": [ + "a" + ] + } } - }, - "QueryBuilder::insert().nodes().ids(\"a\").count(1).query()": { - "InsertNodes": { - "count": 1, - "values": { - "Single": [] - }, - "aliases": [], - "ids": { - "Ids": [ - { - "Alias": "a" - } + ], + [ + "QueryBuilder::insert().aliases(vec![\"a\",\"b\"]).ids(vec![1,2]).query()", + { + "InsertAlias": { + "ids": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + }, + "aliases": [ + "a", + "b" ] } } - }, - "QueryBuilder::search().from(1).where_().beyond().keys(vec![\"k\".into()]).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "Beyond", - "data": { - "Keys": [ - { - "String": "k" - } - ] - } - } - ] + ], + [ + "QueryBuilder::insert().edges().from(1).to(2).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Id": 1 + } + ] + }, + "to": { + "Ids": [ + { + "Id": 2 + } + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [] + }, + "each": false + } } - }, - "QueryBuilder::search().to(1).offset(1).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 1 - }, - "limit": 0, - "offset": 1, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::search().to(1).order_by(vec![DbKeyOrder::Asc(\"k\".into())]).where_().node().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 1 - }, - "limit": 0, - "offset": 0, - "order_by": [ - { - "Asc": { - "String": "k" - } - } - ], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] + ], + [ + "QueryBuilder::insert().edges().from(\"a\").to(\"b\").query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Alias": "a" + } + ] + }, + "to": { + "Ids": [ + { + "Alias": "b" + } + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [] + }, + "each": false + } } - }, - "QueryBuilder::insert().nodes().count(2).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()": { - "InsertNodes": { - "count": 2, - "values": { - "Single": [ - { - "key": { - "String": "k" + ], + [ + "QueryBuilder::insert().edges().from(\"a\").to(vec![1,2]).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Alias": "a" + } + ] + }, + "to": { + "Ids": [ + { + "Id": 1 }, - "value": { - "String": "v" + { + "Id": 2 } - }, - { - "key": { - "I64": 1 + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [] + }, + "each": false + } + } + ], + [ + "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Id": 1 }, - "value": { - "I64": 10 + { + "Id": 2 } - } - ] - }, - "aliases": [], - "ids": { - "Ids": [] - } - } - }, - "QueryBuilder::select().indexes().query()": { - "SelectIndexes": {} - }, - "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"age\".into()),DbKeyOrder::Asc(\"name\".into())]).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [ - { - "Desc": { - "String": "age" - } + ] }, - { - "Asc": { - "String": "name" - } - } - ], - "conditions": [] + "to": { + "Ids": [ + { + "Id": 2 + }, + { + "Id": 3 + } + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [] + }, + "each": false + } } - }, - "QueryBuilder::insert().values(vec![vec![(\"k\",\"v\").into(),(1,10).into()],vec![(\"k\",2).into()]]).ids(vec![1,2]).query()": { - "InsertValues": { - "ids": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "values": { - "Multi": [ - [ + ], + [ + "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().query()", + { + "InsertEdges": { + "from": { + "Ids": [ { - "key": { - "String": "k" - }, - "value": { - "String": "v" + "Id": 1 + }, + { + "Id": 2 + } + ] + }, + "to": { + "Ids": [ + { + "Id": 2 + }, + { + "Id": 3 + } + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [] + }, + "each": true + } + } + ], + [ + "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + }, + "to": { + "Ids": [ + { + "Id": 2 + }, + { + "Id": 3 + } + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Multi": [ + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 1 + } + } + ], + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } } + ] + ] + }, + "each": true + } + } + ], + [ + "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values_uniform(vec![(\"k\",1).into(),(\"k\",2).into()]).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Id": 1 }, + { + "Id": 2 + } + ] + }, + "to": { + "Ids": [ + { + "Id": 2 + }, + { + "Id": 3 + } + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [ { "key": { - "I64": 1 + "String": "k" }, "value": { - "I64": 10 + "I64": 1 } - } - ], - [ + }, { "key": { "String": "k" @@ -235,1437 +310,1133 @@ } } ] - ] + }, + "each": true } } - }, - "QueryBuilder::insert().nodes().count(2).query()": { - "InsertNodes": { - "count": 2, - "values": { - "Single": [] - }, - "aliases": [], - "ids": { - "Ids": [] - } - } - }, - "QueryBuilder::search().breadth_first().from(\"a\").query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::search().from(1).offset(1).where_().node().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 1, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] - } - }, - "QueryBuilder::search().depth_first().to(1).query()": { - "Search": { - "algorithm": "DepthFirst", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 1 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::insert().nodes().aliases(vec![\"a\",\"b\"]).query()": { - "InsertNodes": { - "count": 0, - "values": { - "Single": [] - }, - "aliases": [ - "a", - "b" - ], - "ids": { - "Ids": [] - } - } - }, - "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Asc(\"k\".into())]).where_().node().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [ - { - "Asc": { - "String": "k" - } - } - ], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] - } - }, - "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"k\".into())]).offset(10).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 10, - "order_by": [ - { - "Desc": { - "String": "k" - } - } - ], - "conditions": [] - } - }, - "QueryBuilder::search().from(1).where_().distance(CountComparison::LessThan(3)).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "Distance": { - "LessThan": 3 + ], + [ + "QueryBuilder::insert().edges().from(\"a\").to(vec![1,2]).values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Alias": "a" } - } - } - ] - } - }, - "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values_uniform(vec![(\"k\",1).into(),(\"k\",2).into()]).query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "to": { - "Ids": [ - { - "Id": 2 - }, - { - "Id": 3 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [ - { - "key": { - "String": "k" + ] + }, + "to": { + "Ids": [ + { + "Id": 1 }, - "value": { - "I64": 1 + { + "Id": 2 } - }, - { - "key": { - "String": "k" + ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Multi": [ + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 1 + } + } + ], + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } + } + ] + ] + }, + "each": false + } + } + ], + [ + "QueryBuilder::insert().edges().from(\"a\").to(vec![1,2]).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Alias": "a" + } + ] + }, + "to": { + "Ids": [ + { + "Id": 1 }, - "value": { - "I64": 2 + { + "Id": 2 } - } - ] - }, - "each": true - } - }, - "QueryBuilder::remove().ids(vec![\"a\",\"b\"]).query()": { - "Remove": { - "Ids": [ - { - "Alias": "a" + ] }, - { - "Alias": "b" - } - ] - } - }, - "QueryBuilder::remove().index(\"key\").query()": { - "RemoveIndex": { - "String": "key" - } - }, - "QueryBuilder::insert().element(&T::default()).query()": { - "InsertValues": { - "ids": { - "Ids": [ - { - "Id": 0 - } - ] - }, - "values": { - "Multi": [ - [ + "ids": { + "Ids": [] + }, + "values": { + "Single": [ { "key": { - "String": "value1" + "String": "k" }, "value": { - "String": "" + "String": "v" } }, { "key": { - "String": "value2" + "I64": 1 }, "value": { - "I64": 0 + "I64": 10 } } ] - ] + }, + "each": false } } - }, - "QueryBuilder::search().from(1).offset(10).limit(5).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 5, - "offset": 10, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::search().from(1).where_().ids(vec![1,2]).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "Ids": [ + ], + [ + "QueryBuilder::insert().edges().from(QueryBuilder::search().from(\"a\").where_().node().query()).to(QueryBuilder::search().from(\"b\").where_().node().query()).query()", + { + "InsertEdges": { + "from": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Id": 1 - }, + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } + }, + "to": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "b" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Id": 2 + "logic": "And", + "modifier": "None", + "data": "Node" } ] } - } - ] + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [] + }, + "each": false + } } - }, - "QueryBuilder::search().from(1).where_().not_beyond().ids(\"a\").query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "NotBeyond", - "data": { - "Ids": [ + ], + [ + "QueryBuilder::insert().edges().from(QueryBuilder::search().from(\"a\").where_().node().query()).to(QueryBuilder::search().from(\"b\").where_().node().query()).values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()", + { + "InsertEdges": { + "from": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Alias": "a" + "logic": "And", + "modifier": "None", + "data": "Node" } ] } - } - ] + }, + "to": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "b" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } + }, + "ids": { + "Ids": [] + }, + "values": { + "Multi": [ + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 1 + } + } + ], + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } + } + ] + ] + }, + "each": false + } } - }, - "QueryBuilder::insert().edges().from(QueryBuilder::search().from(\"a\").where_().node().query()).to(QueryBuilder::search().from(\"b\").where_().node().query()).query()": { - "InsertEdges": { - "from": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ + ], + [ + "QueryBuilder::insert().edges().from(QueryBuilder::search().from(\"a\").where_().node().query()).to(QueryBuilder::search().from(\"b\").where_().node().query()).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()", + { + "InsertEdges": { + "from": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } + }, + "to": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "b" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } + }, + "ids": { + "Ids": [] + }, + "values": { + "Single": [ + { + "key": { + "String": "k" + }, + "value": { + "String": "v" + } + }, { - "logic": "And", - "modifier": "None", - "data": "Node" + "key": { + "I64": 1 + }, + "value": { + "I64": 10 + } } ] - } - }, - "to": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "b" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ + }, + "each": false + } + } + ], + [ + "QueryBuilder::insert().edges().ids(-3).from(1).to(2).query()", + { + "InsertEdges": { + "from": { + "Ids": [ { - "logic": "And", - "modifier": "None", - "data": "Node" + "Id": 1 } ] - } - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::select().ids(QueryBuilder::search().from(1).query()).query()": { - "SelectValues": { - "keys": [], - "ids": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } + }, + "to": { + "Ids": [ + { + "Id": 2 + } + ] + }, + "ids": { + "Ids": [ + { + "Id": -3 + } + ] + }, + "values": { + "Single": [] + }, + "each": false } } - }, - "QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1)).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "EdgeCountFrom": { - "Equal": 1 + ], + [ + "QueryBuilder::insert().edges().ids(vec![-3,-4]).from(1).to(2).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Id": 1 } - } - } - ] + ] + }, + "to": { + "Ids": [ + { + "Id": 2 + } + ] + }, + "ids": { + "Ids": [ + { + "Id": -3 + }, + { + "Id": -4 + } + ] + }, + "values": { + "Single": [] + }, + "each": false + } } - }, - "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "to": { - "Ids": [ - { - "Id": 2 - }, - { - "Id": 3 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"k\".into())]).offset(10).limit(5).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 5, - "offset": 10, - "order_by": [ - { - "Desc": { - "String": "k" + ], + [ + "QueryBuilder::insert().edges().ids(QueryBuilder::search().from(1).where_().edge().query()).from(1).to(2).query()", + { + "InsertEdges": { + "from": { + "Ids": [ + { + "Id": 1 + } + ] + }, + "to": { + "Ids": [ + { + "Id": 2 + } + ] + }, + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Edge" + } + ] } + }, + "values": { + "Single": [] + }, + "each": false + } + } + ], + [ + "QueryBuilder::insert().index(\"key\").query()", + { + "InsertIndex": { + "String": "key" + } + } + ], + [ + "QueryBuilder::insert().nodes().count(2).query()", + { + "InsertNodes": { + "count": 2, + "values": { + "Single": [] + }, + "aliases": [], + "ids": { + "Ids": [] } - ], - "conditions": [] - } - }, - "QueryBuilder::search().from(1).where_().key(\"k\").value(Comparison::Equal(1.into())).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "KeyValue": { + } + } + ], + [ + "QueryBuilder::insert().nodes().count(2).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()", + { + "InsertNodes": { + "count": 2, + "values": { + "Single": [ + { "key": { "String": "k" }, "value": { - "Equal": { - "I64": 1 - } + "String": "v" + } + }, + { + "key": { + "I64": 1 + }, + "value": { + "I64": 10 } } - } + ] + }, + "aliases": [], + "ids": { + "Ids": [] } - ] + } } - }, - "QueryBuilder::search().from(1).limit(5).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 5, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::select().values(vec![\"k\".into(),\"k2\".into()]).ids(\"a\").query()": { - "SelectValues": { - "keys": [ - { - "String": "k" - }, - { - "String": "k2" + ], + [ + "QueryBuilder::insert().nodes().aliases(vec![\"a\",\"b\"]).query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Single": [] + }, + "aliases": [ + "a", + "b" + ], + "ids": { + "Ids": [] + } + } + } + ], + [ + "QueryBuilder::insert().nodes().aliases(vec![\"a\",\"b\"]).values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Multi": [ + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 1 + } + } + ], + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } + } + ] + ] + }, + "aliases": [ + "a", + "b" + ], + "ids": { + "Ids": [] } - ], - "ids": { - "Ids": [ - { - "Alias": "a" - } - ] } } - }, - "QueryBuilder::insert().nodes().values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()": { - "InsertNodes": { - "count": 0, - "values": { - "Multi": [ - [ + ], + [ + "QueryBuilder::insert().nodes().aliases(vec![\"a\",\"b\"]).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Single": [ { "key": { "String": "k" }, "value": { - "I64": 1 + "String": "v" } - } - ], - [ + }, { "key": { - "String": "k" + "I64": 1 }, "value": { - "I64": 2 + "I64": 10 } } ] - ] - }, - "aliases": [], - "ids": { - "Ids": [] - } - } - }, - "QueryBuilder::search().from(\"a\").query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::insert().edges().from(1).to(2).query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Id": 1 - } - ] - }, - "to": { - "Ids": [ - { - "Id": 2 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::remove().ids(\"a\").query()": { - "Remove": { - "Ids": [ - { - "Alias": "a" + }, + "aliases": [ + "a", + "b" + ], + "ids": { + "Ids": [] } - ] + } } - }, - "QueryBuilder::insert().values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).ids(vec![1,2]).query()": { - "InsertValues": { - "ids": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "values": { - "Single": [ - { - "key": { - "String": "k" - }, - "value": { - "String": "v" - } - }, - { - "key": { - "I64": 1 - }, - "value": { - "I64": 10 - } - } - ] - } - } - }, - "QueryBuilder::select().aliases().ids(QueryBuilder::search().from(1).query()).query()": { - "SelectAliases": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - } - }, - "QueryBuilder::remove().aliases(\"a\").query()": { - "RemoveAliases": [ - "a" - ] - }, - "QueryBuilder::select().values(vec![\"k\".into(),\"k2\".into()]).ids(QueryBuilder::search().from(1).query()).query()": { - "SelectValues": { - "keys": [ - { - "String": "k" - }, - { - "String": "k2" - } - ], - "ids": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - } - } - }, - "QueryBuilder::insert().nodes().ids(vec![\"a\",\"b\"]).count(1).query()": { - "InsertNodes": { - "count": 1, - "values": { - "Single": [] - }, - "aliases": [], - "ids": { - "Ids": [ - { - "Alias": "a" - }, - { - "Alias": "b" - } - ] - } - } - }, - "QueryBuilder::select().edge_count_to().ids(vec![1,2]).query()": { - "SelectEdgeCount": { - "ids": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "from": false, - "to": true - } - }, - "QueryBuilder::select().keys().ids(QueryBuilder::search().from(1).query()).query()": { - "SelectKeys": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - } - }, - "QueryBuilder::search().from(1).where_().edge().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Edge" - } - ] - } - }, - "QueryBuilder::search().from(1).where_().keys(vec![\"k1\".into(),\"k2\".into()]).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "Keys": [ - { - "String": "k1" - }, + ], + [ + "QueryBuilder::insert().nodes().values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Multi": [ + [ { - "String": "k2" + "key": { + "String": "k" + }, + "value": { + "I64": 1 + } } - ] - } - } - ] - } - }, - "QueryBuilder::insert().index(\"key\").query()": { - "InsertIndex": { - "String": "key" - } - }, - "QueryBuilder::select().edge_count_from().ids(vec![1,2]).query()": { - "SelectEdgeCount": { - "ids": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "from": true, - "to": false - } - }, - "QueryBuilder::search().from(\"a\").to(\"b\").query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Alias": "b" - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::search().from(1).where_().not().keys(vec![\"k1\".into(),\"k2\".into()]).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "Not", - "data": { - "Keys": [ + ], + [ { - "String": "k1" - }, - { - "String": "k2" + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } } ] - } + ] + }, + "aliases": [], + "ids": { + "Ids": [] } - ] - } - }, - "QueryBuilder::insert().aliases(\"a\").ids(\"b\").query()": { - "InsertAlias": { - "ids": { - "Ids": [ - { - "Alias": "b" - } - ] - }, - "aliases": [ - "a" - ] + } } - }, - "QueryBuilder::select().aliases().query()": { - "SelectAllAliases": {} - }, - "QueryBuilder::select().key_count().ids(vec![1,2]).query()": { - "SelectKeyCount": { - "Ids": [ - { - "Id": 1 + ], + [ + "QueryBuilder::insert().nodes().ids(1).count(1).query()", + { + "InsertNodes": { + "count": 1, + "values": { + "Single": [] }, - { - "Id": 2 + "aliases": [], + "ids": { + "Ids": [ + { + "Id": 1 + } + ] } - ] + } } - }, - "QueryBuilder::select().keys().ids(\"a\").query()": { - "SelectKeys": { - "Ids": [ - { - "Alias": "a" + ], + [ + "QueryBuilder::insert().nodes().ids(vec![1,2]).count(1).query()", + { + "InsertNodes": { + "count": 1, + "values": { + "Single": [] + }, + "aliases": [], + "ids": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] } - ] + } } - }, - "QueryBuilder::remove().ids(QueryBuilder::search().from(\"a\").query()).query()": { - "Remove": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 + ], + [ + "QueryBuilder::insert().nodes().ids(\"a\").count(1).query()", + { + "InsertNodes": { + "count": 1, + "values": { + "Single": [] }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] + "aliases": [], + "ids": { + "Ids": [ + { + "Alias": "a" + } + ] + } } } - }, - "QueryBuilder::search().from(1).where_().node().or().edge().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - }, - { - "logic": "Or", - "modifier": "None", - "data": "Edge" + ], + [ + "QueryBuilder::insert().nodes().ids(\"a\").aliases(\"a\").query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Single": [] + }, + "aliases": [ + "a" + ], + "ids": { + "Ids": [ + { + "Alias": "a" + } + ] } - ] + } } - }, - "QueryBuilder::search().from(1).where_().node().and().distance(CountComparison::GreaterThanOrEqual(3)).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - }, - { - "logic": "And", - "modifier": "None", - "data": { - "Distance": { - "GreaterThanOrEqual": 3 + ], + [ + "QueryBuilder::insert().nodes().ids(vec![\"a\",\"b\"]).count(1).query()", + { + "InsertNodes": { + "count": 1, + "values": { + "Single": [] + }, + "aliases": [], + "ids": { + "Ids": [ + { + "Alias": "a" + }, + { + "Alias": "b" } - } + ] } - ] + } } - }, - "QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key(\"k\").value(Comparison::Equal(1.into())).end_where().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - }, - { - "logic": "Or", - "modifier": "None", - "data": { - "Where": [ + ], + [ + "QueryBuilder::insert().nodes().ids(vec![1,2]).values(vec![vec![(\"k\",\"v\").into()],vec![(1,10).into()]]).query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Multi": [ + [ { - "logic": "And", - "modifier": "None", - "data": "Edge" - }, + "key": { + "String": "k" + }, + "value": { + "String": "v" + } + } + ], + [ { - "logic": "And", - "modifier": "None", - "data": { - "KeyValue": { - "key": { - "String": "k" - }, - "value": { - "Equal": { - "I64": 1 - } - } - } + "key": { + "I64": 1 + }, + "value": { + "I64": 10 } } ] - } + ] + }, + "aliases": [], + "ids": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] } - ] + } } - }, - "QueryBuilder::search().from(1).offset(10).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 10, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "to": { - "Ids": [ - { - "Id": 2 - }, - { - "Id": 3 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Multi": [ - [ + ], + [ + "QueryBuilder::insert().nodes().ids(vec![1,2]).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()", + { + "InsertNodes": { + "count": 0, + "values": { + "Single": [ { "key": { "String": "k" }, "value": { - "I64": 1 + "String": "v" } - } - ], - [ + }, { "key": { - "String": "k" + "I64": 1 }, "value": { - "I64": 2 + "I64": 10 } } ] - ] - }, - "each": true - } - }, - "QueryBuilder::select().keys().ids(vec![1,2]).query()": { - "SelectKeys": { - "Ids": [ - { - "Id": 1 }, - { - "Id": 2 + "aliases": [], + "ids": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + } + } + } + ], + [ + "QueryBuilder::insert().nodes().ids(QueryBuilder::search().from(1).query()).count(1).query()", + { + "InsertNodes": { + "count": 1, + "values": { + "Single": [] + }, + "aliases": [], + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } } - ] + } } - }, - "QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key(\"k\").value(Comparison::Contains(1.into())).end_where().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - }, - { - "logic": "Or", - "modifier": "None", - "data": { - "Where": [ + ], + [ + "QueryBuilder::insert().element(&T::default()).query()", + { + "InsertValues": { + "ids": { + "Ids": [ + { + "Id": 0 + } + ] + }, + "values": { + "Multi": [ + [ { - "logic": "And", - "modifier": "None", - "data": "Edge" + "key": { + "String": "value1" + }, + "value": { + "String": "" + } }, { - "logic": "And", - "modifier": "None", - "data": { - "KeyValue": { - "key": { - "String": "k" - }, - "value": { - "Contains": { - "I64": 1 - } - } - } + "key": { + "String": "value2" + }, + "value": { + "I64": 0 } } ] - } + ] } - ] - } - }, - "QueryBuilder::insert().aliases(\"a\").ids(1).query()": { - "InsertAlias": { - "ids": { - "Ids": [ - { - "Id": 1 - } - ] - }, - "aliases": [ - "a" - ] + } } - }, - "QueryBuilder::insert().edges().from(\"a\").to(vec![1,2]).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Alias": "a" - } - ] - }, - "to": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [ - { - "key": { - "String": "k" + ], + [ + "QueryBuilder::insert().elements(&[T::default(),T::default()]).query()", + { + "InsertValues": { + "ids": { + "Ids": [ + { + "Id": 0 }, - "value": { - "String": "v" + { + "Id": 0 } - }, - { - "key": { - "I64": 1 + ] + }, + "values": { + "Multi": [ + [ + { + "key": { + "String": "value1" + }, + "value": { + "String": "" + } + }, + { + "key": { + "String": "value2" + }, + "value": { + "I64": 0 + } + } + ], + [ + { + "key": { + "String": "value1" + }, + "value": { + "String": "" + } + }, + { + "key": { + "String": "value2" + }, + "value": { + "I64": 0 + } + } + ] + ] + } + } + } + ], + [ + "QueryBuilder::insert().values(vec![vec![(\"k\",\"v\").into(),(1,10).into()],vec![(\"k\",2).into()]]).ids(vec![1,2]).query()", + { + "InsertValues": { + "ids": { + "Ids": [ + { + "Id": 1 }, - "value": { - "I64": 10 + { + "Id": 2 } + ] + }, + "values": { + "Multi": [ + [ + { + "key": { + "String": "k" + }, + "value": { + "String": "v" + } + }, + { + "key": { + "I64": 1 + }, + "value": { + "I64": 10 + } + } + ], + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } + } + ] + ] + } + } + } + ], + [ + "QueryBuilder::insert().values(vec![vec![(\"k\",\"v\").into(),(1,10).into()],vec![(\"k\",2).into()]]).ids(QueryBuilder::search().from(\"a\").query()).query()", + { + "InsertValues": { + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] } - ] - }, - "each": false + }, + "values": { + "Multi": [ + [ + { + "key": { + "String": "k" + }, + "value": { + "String": "v" + } + }, + { + "key": { + "I64": 1 + }, + "value": { + "I64": 10 + } + } + ], + [ + { + "key": { + "String": "k" + }, + "value": { + "I64": 2 + } + } + ] + ] + } + } } - }, - "QueryBuilder::insert().nodes().aliases(vec![\"a\",\"b\"]).values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()": { - "InsertNodes": { - "count": 0, - "values": { - "Multi": [ - [ + ], + [ + "QueryBuilder::insert().values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).ids(vec![1,2]).query()", + { + "InsertValues": { + "ids": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + }, + "values": { + "Single": [ { "key": { "String": "k" }, "value": { - "I64": 1 + "String": "v" } - } - ], - [ + }, { "key": { - "String": "k" + "I64": 1 }, "value": { - "I64": 2 + "I64": 10 } } ] - ] - }, - "aliases": [ - "a", - "b" - ], - "ids": { - "Ids": [] - } - } - }, - "QueryBuilder::search().from(1).where_().edge_count_to(CountComparison::NotEqual(1)).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "EdgeCountTo": { - "NotEqual": 1 - } - } } - ] + } } - }, - "QueryBuilder::search().to(1).limit(1).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 1 - }, - "limit": 1, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::insert().edges().from(\"a\").to(\"b\").query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Alias": "a" - } - ] - }, - "to": { - "Ids": [ - { - "Alias": "b" + ], + [ + "QueryBuilder::insert().values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).ids(QueryBuilder::search().from(\"a\").query()).query()", + { + "InsertValues": { + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key(\"k\").value(Comparison::Contains((vec![1,2]).into())).end_where().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - }, - { - "logic": "Or", - "modifier": "None", - "data": { - "Where": [ - { - "logic": "And", - "modifier": "None", - "data": "Edge" + }, + "values": { + "Single": [ + { + "key": { + "String": "k" }, - { - "logic": "And", - "modifier": "None", - "data": { - "KeyValue": { - "key": { - "String": "k" - }, - "value": { - "Contains": { - "VecI64": [ - 1, - 2 - ] - } - } - } - } + "value": { + "String": "v" } - ] - } + }, + { + "key": { + "I64": 1 + }, + "value": { + "I64": 10 + } + } + ] } - ] - } - }, - "QueryBuilder::remove().aliases(vec![\"a\",\"b\"]).query()": { - "RemoveAliases": [ - "a", - "b" - ] - }, - "QueryBuilder::insert().nodes().ids(1).count(1).query()": { - "InsertNodes": { - "count": 1, - "values": { - "Single": [] - }, - "aliases": [], - "ids": { - "Ids": [ - { - "Id": 1 - } - ] } } - }, - "QueryBuilder::remove().ids(vec![1,2]).query()": { - "Remove": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } + ], + [ + "QueryBuilder::remove().aliases(\"a\").query()", + { + "RemoveAliases": [ + "a" + ] + } + ], + [ + "QueryBuilder::remove().aliases(vec![\"a\",\"b\"]).query()", + { + "RemoveAliases": [ + "a", + "b" ] } - }, - "QueryBuilder::select().ids(vec![1,2]).query()": { - "SelectValues": { - "keys": [], - "ids": { + ], + [ + "QueryBuilder::remove().ids(1).query()", + { + "Remove": { "Ids": [ { "Id": 1 - }, - { - "Id": 2 } ] } } - }, - "QueryBuilder::select().ids(\"a\").query()": { - "SelectValues": { - "keys": [], - "ids": { + ], + [ + "QueryBuilder::remove().ids(\"a\").query()", + { + "Remove": { "Ids": [ { "Alias": "a" @@ -1673,15 +1444,11 @@ ] } } - }, - "QueryBuilder::insert().nodes().ids(vec![1,2]).count(1).query()": { - "InsertNodes": { - "count": 1, - "values": { - "Single": [] - }, - "aliases": [], - "ids": { + ], + [ + "QueryBuilder::remove().ids(vec![1,2]).query()", + { + "Remove": { "Ids": [ { "Id": 1 @@ -1692,29 +1459,26 @@ ] } } - }, - "QueryBuilder::select().node_count().query()": { - "SelectNodeCount": {} - }, - "QueryBuilder::select().edge_count().ids(vec![1,2]).query()": { - "SelectEdgeCount": { - "ids": { + ], + [ + "QueryBuilder::remove().ids(vec![\"a\",\"b\"]).query()", + { + "Remove": { "Ids": [ { - "Id": 1 + "Alias": "a" }, { - "Id": 2 + "Alias": "b" } ] - }, - "from": true, - "to": true - } - }, - "QueryBuilder::insert().edges().from(QueryBuilder::search().from(\"a\").where_().node().query()).to(QueryBuilder::search().from(\"b\").where_().node().query()).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()": { - "InsertEdges": { - "from": { + } + } + ], + [ + "QueryBuilder::remove().ids(QueryBuilder::search().from(\"a\").query()).query()", + { + "Remove": { "Search": { "algorithm": "BreadthFirst", "origin": { @@ -1726,20 +1490,97 @@ "limit": 0, "offset": 0, "order_by": [], - "conditions": [ + "conditions": [] + } + } + } + ], + [ + "QueryBuilder::remove().index(\"key\").query()", + { + "RemoveIndex": { + "String": "key" + } + } + ], + [ + "QueryBuilder::remove().values(vec![\"k1\".into(),\"k2\".into()]).ids(vec![1,2]).query()", + { + "RemoveValues": { + "keys": [ + { + "String": "k1" + }, + { + "String": "k2" + } + ], + "ids": { + "Ids": [ { - "logic": "And", - "modifier": "None", - "data": "Node" + "Id": 1 + }, + { + "Id": 2 } ] } - }, - "to": { + } + } + ], + [ + "QueryBuilder::remove().values(vec![\"k1\".into(),\"k2\".into()]).ids(QueryBuilder::search().from(\"a\").query()).query()", + { + "RemoveValues": { + "keys": [ + { + "String": "k1" + }, + { + "String": "k2" + } + ], + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + } + } + ], + [ + "QueryBuilder::select().aliases().ids(vec![1,2]).query()", + { + "SelectAliases": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + } + } + ], + [ + "QueryBuilder::select().aliases().ids(QueryBuilder::search().from(1).query()).query()", + { + "SelectAliases": { "Search": { "algorithm": "BreadthFirst", "origin": { - "Alias": "b" + "Id": 1 }, "destination": { "Id": 0 @@ -1747,90 +1588,167 @@ "limit": 0, "offset": 0, "order_by": [], - "conditions": [ + "conditions": [] + } + } + } + ], + [ + "QueryBuilder::select().aliases().query()", + { + "SelectAllAliases": {} + } + ], + [ + "QueryBuilder::select().edge_count().ids(vec![1,2]).query()", + { + "SelectEdgeCount": { + "ids": { + "Ids": [ + { + "Id": 1 + }, { - "logic": "And", - "modifier": "None", - "data": "Node" + "Id": 2 } ] - } - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [ - { - "key": { - "String": "k" + }, + "from": true, + "to": true + } + } + ], + [ + "QueryBuilder::select().edge_count_from().ids(vec![1,2]).query()", + { + "SelectEdgeCount": { + "ids": { + "Ids": [ + { + "Id": 1 }, - "value": { - "String": "v" + { + "Id": 2 } - }, - { - "key": { - "I64": 1 + ] + }, + "from": true, + "to": false + } + } + ], + [ + "QueryBuilder::select().edge_count_to().ids(vec![1,2]).query()", + { + "SelectEdgeCount": { + "ids": { + "Ids": [ + { + "Id": 1 }, - "value": { - "I64": 10 + { + "Id": 2 } - } - ] - }, - "each": false + ] + }, + "from": false, + "to": true + } } - }, - "QueryBuilder::insert().edges().ids(vec![-3,-4]).from(1).to(2).query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Id": 1 - } - ] - }, - "to": { - "Ids": [ - { - "Id": 2 + ], + [ + "QueryBuilder::select().ids(\"a\").query()", + { + "SelectValues": { + "keys": [], + "ids": { + "Ids": [ + { + "Alias": "a" + } + ] + } + } + } + ], + [ + "QueryBuilder::select().ids(vec![1,2]).query()", + { + "SelectValues": { + "keys": [], + "ids": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + } + } + } + ], + [ + "QueryBuilder::select().ids(QueryBuilder::search().from(1).query()).query()", + { + "SelectValues": { + "keys": [], + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] } - ] - }, - "ids": { + } + } + } + ], + [ + "QueryBuilder::select().indexes().query()", + { + "SelectIndexes": {} + } + ], + [ + "QueryBuilder::select().keys().ids(\"a\").query()", + { + "SelectKeys": { "Ids": [ { - "Id": -3 - }, - { - "Id": -4 + "Alias": "a" } ] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::insert().edges().ids(QueryBuilder::search().from(1).where_().edge().query()).from(1).to(2).query()": { - "InsertEdges": { - "from": { + } + } + ], + [ + "QueryBuilder::select().keys().ids(vec![1,2]).query()", + { + "SelectKeys": { "Ids": [ { "Id": 1 - } - ] - }, - "to": { - "Ids": [ + }, { "Id": 2 } ] - }, - "ids": { + } + } + ], + [ + "QueryBuilder::select().keys().ids(QueryBuilder::search().from(1).query()).query()", + { + "SelectKeys": { "Search": { "algorithm": "BreadthFirst", "origin": { @@ -1842,213 +1760,27 @@ "limit": 0, "offset": 0, "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Edge" - } - ] + "conditions": [] } - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::insert().edges().from(\"a\").to(vec![1,2]).values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()": { - "InsertEdges": { - "from": { + } + } + ], + [ + "QueryBuilder::select().key_count().ids(\"a\").query()", + { + "SelectKeyCount": { "Ids": [ { "Alias": "a" } ] - }, - "to": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Multi": [ - [ - { - "key": { - "String": "k" - }, - "value": { - "I64": 1 - } - } - ], - [ - { - "key": { - "String": "k" - }, - "value": { - "I64": 2 - } - } - ] - ] - }, - "each": false - } - }, - "QueryBuilder::select().aliases().ids(vec![1,2]).query()": { - "SelectAliases": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - } - }, - "QueryBuilder::insert().edges().from(vec![1,2]).to(vec![2,3]).each().query()": { - "InsertEdges": { - "from": { - "Ids": [ - { - "Id": 1 - }, - { - "Id": 2 - } - ] - }, - "to": { - "Ids": [ - { - "Id": 2 - }, - { - "Id": 3 - } - ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [] - }, - "each": true - } - }, - "QueryBuilder::insert().elements(&[T::default(),T::default()]).query()": { - "InsertValues": { - "ids": { - "Ids": [ - { - "Id": 0 - }, - { - "Id": 0 - } - ] - }, - "values": { - "Multi": [ - [ - { - "key": { - "String": "value1" - }, - "value": { - "String": "" - } - }, - { - "key": { - "String": "value2" - }, - "value": { - "I64": 0 - } - } - ], - [ - { - "key": { - "String": "value1" - }, - "value": { - "String": "" - } - }, - { - "key": { - "String": "value2" - }, - "value": { - "I64": 0 - } - } - ] - ] - } - } - }, - "QueryBuilder::search().from(1).limit(1).where_().node().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 1, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] - } - }, - "QueryBuilder::insert().nodes().ids(vec![1,2]).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()": { - "InsertNodes": { - "count": 0, - "values": { - "Single": [ - { - "key": { - "String": "k" - }, - "value": { - "String": "v" - } - }, - { - "key": { - "I64": 1 - }, - "value": { - "I64": 10 - } - } - ] - }, - "aliases": [], - "ids": { + } + } + ], + [ + "QueryBuilder::select().key_count().ids(vec![1,2]).query()", + { + "SelectKeyCount": { "Ids": [ { "Id": 1 @@ -2059,47 +1791,11 @@ ] } } - }, - "QueryBuilder::insert().nodes().aliases(vec![\"a\",\"b\"]).values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).query()": { - "InsertNodes": { - "count": 0, - "values": { - "Single": [ - { - "key": { - "String": "k" - }, - "value": { - "String": "v" - } - }, - { - "key": { - "I64": 1 - }, - "value": { - "I64": 10 - } - } - ] - }, - "aliases": [ - "a", - "b" - ], - "ids": { - "Ids": [] - } - } - }, - "QueryBuilder::insert().nodes().ids(QueryBuilder::search().from(1).query()).count(1).query()": { - "InsertNodes": { - "count": 1, - "values": { - "Single": [] - }, - "aliases": [], - "ids": { + ], + [ + "QueryBuilder::select().key_count().ids(QueryBuilder::search().from(1).query()).query()", + { + "SelectKeyCount": { "Search": { "algorithm": "BreadthFirst", "origin": { @@ -2115,316 +1811,858 @@ } } } - }, - "QueryBuilder::insert().nodes().ids(vec![1,2]).values(vec![vec![(\"k\",\"v\").into()],vec![(1,10).into()]]).query()": { - "InsertNodes": { - "count": 0, - "values": { - "Multi": [ - [ - { - "key": { - "String": "k" - }, - "value": { - "String": "v" - } - } - ], - [ - { - "key": { - "I64": 1 - }, - "value": { - "I64": 10 - } - } - ] - ] - }, - "aliases": [], - "ids": { - "Ids": [ + ], + [ + "QueryBuilder::select().node_count().query()", + { + "SelectNodeCount": {} + } + ], + [ + "QueryBuilder::select().values(vec![\"k\".into(),\"k2\".into()]).ids(\"a\").query()", + { + "SelectValues": { + "keys": [ { - "Id": 1 + "String": "k" }, { - "Id": 2 + "String": "k2" } - ] - } - } - }, - "QueryBuilder::insert().edges().from(QueryBuilder::search().from(\"a\").where_().node().query()).to(QueryBuilder::search().from(\"b\").where_().node().query()).values(vec![vec![(\"k\",1).into()],vec![(\"k\",2).into()]]).query()": { - "InsertEdges": { - "from": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ + ], + "ids": { + "Ids": [ { - "logic": "And", - "modifier": "None", - "data": "Node" + "Alias": "a" } ] } - }, - "to": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "b" - }, - "destination": { - "Id": 0 + } + } + ], + [ + "QueryBuilder::select().values(vec![\"k\".into(),\"k2\".into()]).ids(vec![1,2]).query()", + { + "SelectValues": { + "keys": [ + { + "String": "k" }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] - } - }, - "ids": { - "Ids": [] - }, - "values": { - "Multi": [ - [ + { + "String": "k2" + } + ], + "ids": { + "Ids": [ { - "key": { - "String": "k" - }, - "value": { - "I64": 1 - } - } - ], - [ + "Id": 1 + }, { - "key": { - "String": "k" - }, - "value": { - "I64": 2 - } + "Id": 2 } ] - ] - }, - "each": false + } + } } - }, - "QueryBuilder::insert().edges().ids(-3).from(1).to(2).query()": { - "InsertEdges": { - "from": { - "Ids": [ + ], + [ + "QueryBuilder::select().values(vec![\"k\".into(),\"k2\".into()]).ids(QueryBuilder::search().from(1).query()).query()", + { + "SelectValues": { + "keys": [ { - "Id": 1 - } - ] - }, - "to": { - "Ids": [ + "String": "k" + }, { - "Id": 2 + "String": "k2" } - ] - }, - "ids": { - "Ids": [ - { - "Id": -3 + ], + "ids": { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] } - ] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::insert().values(vec![vec![(\"k\",\"v\").into(),(1,10).into()],vec![(\"k\",2).into()]]).ids(QueryBuilder::search().from(\"a\").query()).query()": { - "InsertValues": { - "ids": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] } - }, - "values": { - "Multi": [ - [ - { - "key": { - "String": "k" - }, - "value": { - "String": "v" - } - }, - { - "key": { - "I64": 1 - }, - "value": { - "I64": 10 - } - } - ], - [ - { - "key": { - "String": "k" - }, - "value": { - "I64": 2 - } + } + } + ], + [ + "QueryBuilder::search().from(\"a\").query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().to(1).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 1 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(\"a\").to(\"b\").query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Alias": "b" + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().breadth_first().from(\"a\").query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().depth_first().to(1).query()", + { + "Search": { + "algorithm": "DepthFirst", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 1 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().depth_first().from(\"a\").query()", + { + "Search": { + "algorithm": "DepthFirst", + "origin": { + "Alias": "a" + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().elements().query()", + { + "Search": { + "algorithm": "Elements", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().index(\"age\").value(20).query()", + { + "Search": { + "algorithm": "Index", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "KeyValue": { + "key": { + "String": "age" + }, + "value": { + "Equal": { + "I64": 20 + } + } + } + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"age\".into()),DbKeyOrder::Asc(\"name\".into())]).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [ + { + "Desc": { + "String": "age" + } + }, + { + "Asc": { + "String": "name" + } + } + ], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).offset(10).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 10, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).limit(5).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 5, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"k\".into())]).offset(10).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 10, + "order_by": [ + { + "Desc": { + "String": "k" + } + } + ], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"k\".into())]).limit(5).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 5, + "offset": 0, + "order_by": [ + { + "Desc": { + "String": "k" + } + } + ], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"k\".into())]).offset(10).limit(5).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 5, + "offset": 10, + "order_by": [ + { + "Desc": { + "String": "k" + } + } + ], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).offset(10).limit(5).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 5, + "offset": 10, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().distance(CountComparison::LessThan(3)).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "Distance": { + "LessThan": 3 + } + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().edge().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Edge" + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().edge_count(CountComparison::GreaterThan(2)).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "EdgeCount": { + "GreaterThan": 2 + } + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1)).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "EdgeCountFrom": { + "Equal": 1 + } + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().edge_count_to(CountComparison::NotEqual(1)).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "EdgeCountTo": { + "NotEqual": 1 + } + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().node().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().key(\"k\").value(Comparison::Equal(1.into())).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "KeyValue": { + "key": { + "String": "k" + }, + "value": { + "Equal": { + "I64": 1 + } + } + } + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().keys(vec![\"k1\".into(),\"k2\".into()]).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "Keys": [ + { + "String": "k1" + }, + { + "String": "k2" + } + ] + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().not().keys(vec![\"k1\".into(),\"k2\".into()]).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "Not", + "data": { + "Keys": [ + { + "String": "k1" + }, + { + "String": "k2" + } + ] + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().ids(vec![1,2]).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().beyond().keys(vec![\"k\".into()]).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "Beyond", + "data": { + "Keys": [ + { + "String": "k" + } + ] + } + } + ] + } + } + ], + [ + "QueryBuilder::search().from(1).where_().not().ids(vec![1,2]).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "Not", + "data": { + "Ids": [ + { + "Id": 1 + }, + { + "Id": 2 + } + ] } - ] + } ] } } - }, - "QueryBuilder::insert().values_uniform(vec![(\"k\",\"v\").into(),(1,10).into()]).ids(QueryBuilder::search().from(\"a\").query()).query()": { - "InsertValues": { - "ids": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "values": { - "Single": [ - { - "key": { - "String": "k" - }, - "value": { - "String": "v" - } - }, - { - "key": { - "I64": 1 - }, - "value": { - "I64": 10 + ], + [ + "QueryBuilder::search().from(1).where_().not_beyond().ids(\"a\").query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "NotBeyond", + "data": { + "Ids": [ + { + "Alias": "a" + } + ] } } ] } } - }, - "QueryBuilder::remove().values(vec![\"k1\".into(),\"k2\".into()]).ids(vec![1,2]).query()": { - "RemoveValues": { - "keys": [ - { - "String": "k1" + ], + [ + "QueryBuilder::search().from(1).where_().node().or().edge().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 }, - { - "String": "k2" - } - ], - "ids": { - "Ids": [ + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Id": 1 + "logic": "And", + "modifier": "None", + "data": "Node" }, { - "Id": 2 + "logic": "Or", + "modifier": "None", + "data": "Edge" } ] } } - }, - "QueryBuilder::search().to(1).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 1 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::search().depth_first().from(\"a\").query()": { - "Search": { - "algorithm": "DepthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::select().values(vec![\"k\".into(),\"k2\".into()]).ids(vec![1,2]).query()": { - "SelectValues": { - "keys": [ - { - "String": "k" - }, - { - "String": "k2" - } - ], - "ids": { - "Ids": [ + ], + [ + "QueryBuilder::search().from(1).where_().node().and().distance(CountComparison::GreaterThanOrEqual(3)).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Id": 1 + "logic": "And", + "modifier": "None", + "data": "Node" }, { - "Id": 2 + "logic": "And", + "modifier": "None", + "data": { + "Distance": { + "GreaterThanOrEqual": 3 + } + } } ] } } - }, - "QueryBuilder::select().key_count().ids(QueryBuilder::search().from(1).query()).query()": { - "SelectKeyCount": { + ], + [ + "QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key(\"k\").value(Comparison::Equal(1.into())).end_where().query()", + { "Search": { "algorithm": "BreadthFirst", "origin": { @@ -2436,231 +2674,320 @@ "limit": 0, "offset": 0, "order_by": [], - "conditions": [] - } - } - }, - "QueryBuilder::search().elements().query()": { - "Search": { - "algorithm": "Elements", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } - }, - "QueryBuilder::select().key_count().ids(\"a\").query()": { - "SelectKeyCount": { - "Ids": [ - { - "Alias": "a" - } - ] - } - }, - "QueryBuilder::search().index(\"age\").value(20).query()": { - "Search": { - "algorithm": "Index", - "origin": { - "Id": 0 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "KeyValue": { - "key": { - "String": "age" - }, - "value": { - "Equal": { - "I64": 20 + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + }, + { + "logic": "Or", + "modifier": "None", + "data": { + "Where": [ + { + "logic": "And", + "modifier": "None", + "data": "Edge" + }, + { + "logic": "And", + "modifier": "None", + "data": { + "KeyValue": { + "key": { + "String": "k" + }, + "value": { + "Equal": { + "I64": 1 + } + } + } + } } - } + ] } } - } - ] + ] + } } - }, - "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Desc(\"k\".into())]).limit(5).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 5, - "offset": 0, - "order_by": [ - { - "Desc": { - "String": "k" + ], + [ + "QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key(\"k\").value(Comparison::Contains(1.into())).end_where().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + }, + { + "logic": "Or", + "modifier": "None", + "data": { + "Where": [ + { + "logic": "And", + "modifier": "None", + "data": "Edge" + }, + { + "logic": "And", + "modifier": "None", + "data": { + "KeyValue": { + "key": { + "String": "k" + }, + "value": { + "Contains": { + "I64": 1 + } + } + } + } + } + ] + } } - } - ], - "conditions": [] + ] + } } - }, - "QueryBuilder::insert().aliases(vec![\"a\",\"b\"]).ids(vec![1,2]).query()": { - "InsertAlias": { - "ids": { - "Ids": [ + ], + [ + "QueryBuilder::search().from(1).where_().node().or().where_().edge().and().key(\"k\").value(Comparison::Contains((vec![1,2]).into())).end_where().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Id": 1 + "logic": "And", + "modifier": "None", + "data": "Node" }, { - "Id": 2 + "logic": "Or", + "modifier": "None", + "data": { + "Where": [ + { + "logic": "And", + "modifier": "None", + "data": "Edge" + }, + { + "logic": "And", + "modifier": "None", + "data": { + "KeyValue": { + "key": { + "String": "k" + }, + "value": { + "Contains": { + "VecI64": [ + 1, + 2 + ] + } + } + } + } + } + ] + } } ] - }, - "aliases": [ - "a", - "b" - ] + } } - }, - "QueryBuilder::search().from(1).where_().edge_count(CountComparison::GreaterThan(2)).query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": { - "EdgeCount": { - "GreaterThan": 2 + ], + [ + "QueryBuilder::search().from(1).order_by(vec![DbKeyOrder::Asc(\"k\".into())]).where_().node().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 0, + "order_by": [ + { + "Asc": { + "String": "k" } } - } - ] + ], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } } - }, - "QueryBuilder::search().from(1).where_().node().query()": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Id": 1 - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [ - { - "logic": "And", - "modifier": "None", - "data": "Node" - } - ] + ], + [ + "QueryBuilder::search().from(1).limit(1).where_().node().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 1, + "offset": 0, + "order_by": [], + "conditions": [ + { + "logic": "And", + "modifier": "None", + "data": "Node" + } + ] + } } - }, - "QueryBuilder::insert().nodes().ids(\"a\").aliases(\"a\").query()": { - "InsertNodes": { - "count": 0, - "values": { - "Single": [] - }, - "aliases": [ - "a" - ], - "ids": { - "Ids": [ + ], + [ + "QueryBuilder::search().from(1).offset(1).where_().node().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 1 + }, + "destination": { + "Id": 0 + }, + "limit": 0, + "offset": 1, + "order_by": [], + "conditions": [ { - "Alias": "a" + "logic": "And", + "modifier": "None", + "data": "Node" } ] } } - }, - "QueryBuilder::remove().values(vec![\"k1\".into(),\"k2\".into()]).ids(QueryBuilder::search().from(\"a\").query()).query()": { - "RemoveValues": { - "keys": [ - { - "String": "k1" + ], + [ + "QueryBuilder::search().to(1).offset(1).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 0 }, - { - "String": "k2" - } - ], - "ids": { - "Search": { - "algorithm": "BreadthFirst", - "origin": { - "Alias": "a" - }, - "destination": { - "Id": 0 - }, - "limit": 0, - "offset": 0, - "order_by": [], - "conditions": [] - } + "destination": { + "Id": 1 + }, + "limit": 0, + "offset": 1, + "order_by": [], + "conditions": [] } } - }, - "QueryBuilder::insert().edges().from(\"a\").to(vec![1,2]).query()": { - "InsertEdges": { - "from": { - "Ids": [ + ], + [ + "QueryBuilder::search().to(1).limit(1).query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 1 + }, + "limit": 1, + "offset": 0, + "order_by": [], + "conditions": [] + } + } + ], + [ + "QueryBuilder::search().to(1).where_().node().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 1 + }, + "limit": 0, + "offset": 0, + "order_by": [], + "conditions": [ { - "Alias": "a" + "logic": "And", + "modifier": "None", + "data": "Node" } ] - }, - "to": { - "Ids": [ + } + } + ], + [ + "QueryBuilder::search().to(1).order_by(vec![DbKeyOrder::Asc(\"k\".into())]).where_().node().query()", + { + "Search": { + "algorithm": "BreadthFirst", + "origin": { + "Id": 0 + }, + "destination": { + "Id": 1 + }, + "limit": 0, + "offset": 0, + "order_by": [ { - "Id": 1 - }, + "Asc": { + "String": "k" + } + } + ], + "conditions": [ { - "Id": 2 + "logic": "And", + "modifier": "None", + "data": "Node" } ] - }, - "ids": { - "Ids": [] - }, - "values": { - "Single": [] - }, - "each": false - } - }, - "QueryBuilder::remove().ids(1).query()": { - "Remove": { - "Ids": [ - { - "Id": 1 - } - ] + } } - } -} \ No newline at end of file + ] +] \ No newline at end of file diff --git a/agdb_server/src/main.rs b/agdb_server/src/main.rs index 4bb454cd..53e454bb 100644 --- a/agdb_server/src/main.rs +++ b/agdb_server/src/main.rs @@ -50,7 +50,6 @@ mod tests { use agdb::QueryId; use agdb::QueryType; use agdb::UserValue; - use std::collections::HashMap; use std::fs::File; use std::io::Write; use utoipa::OpenApi; @@ -58,15 +57,15 @@ mod tests { macro_rules! queries { ($($x:expr),+ $(,)?) => { { - let mut map: HashMap = HashMap::new(); + let mut vec: Vec<(String, QueryType)> = Vec::new(); $( { let mut as_string = stringify!($x).to_string(); as_string.retain(|c| !c.is_whitespace()); - map.insert(as_string, $x.into()); + vec.push((as_string, $x.into())); } )* - map + vec } }; }