Enable path expressions starting from params
This commit is contained in:
parent
449ce9a4a8
commit
8fadbc9f35
2 changed files with 398 additions and 9 deletions
37
db/fetch.go
37
db/fetch.go
|
@ -57,10 +57,6 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o
|
||||||
case doc != nil:
|
case doc != nil:
|
||||||
|
|
||||||
doc.Fetch(func(key string, val interface{}) interface{} {
|
doc.Fetch(func(key string, val interface{}) interface{} {
|
||||||
switch key {
|
|
||||||
case ctxKeyId:
|
|
||||||
return val
|
|
||||||
default:
|
|
||||||
switch res := val.(type) {
|
switch res := val.(type) {
|
||||||
case *sql.Thing:
|
case *sql.Thing:
|
||||||
val, _ = e.fetchThing(ctx, res, doc)
|
val, _ = e.fetchThing(ctx, res, doc)
|
||||||
|
@ -68,7 +64,6 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o
|
||||||
default:
|
default:
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return e.fetch(ctx, doc.Get(val.ID).Data(), doc)
|
return e.fetch(ctx, doc.Get(val.ID).Data(), doc)
|
||||||
|
@ -78,15 +73,41 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o
|
||||||
case *sql.Param:
|
case *sql.Param:
|
||||||
|
|
||||||
if obj, ok := ctx.Value(ctxKeySubs).(*data.Doc); ok {
|
if obj, ok := ctx.Value(ctxKeySubs).(*data.Doc); ok {
|
||||||
|
|
||||||
|
obj.Fetch(func(key string, val interface{}) interface{} {
|
||||||
|
switch res := val.(type) {
|
||||||
|
case *sql.Thing:
|
||||||
|
val, _ = e.fetchThing(ctx, res, doc)
|
||||||
|
return val
|
||||||
|
default:
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if res := obj.Get(val.ID).Data(); res != nil {
|
if res := obj.Get(val.ID).Data(); res != nil {
|
||||||
return e.fetch(ctx, res, doc)
|
return e.fetch(ctx, res, doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if obj, ok := ctx.Value(ctxKeyVars).(*data.Doc); ok {
|
if obj, ok := ctx.Value(ctxKeyVars).(*data.Doc); ok {
|
||||||
|
|
||||||
|
obj.Fetch(func(key string, val interface{}) interface{} {
|
||||||
|
switch res := val.(type) {
|
||||||
|
case *sql.Thing:
|
||||||
|
val, _ = e.fetchThing(ctx, res, doc)
|
||||||
|
return val
|
||||||
|
default:
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if res := obj.Get(val.ID).Data(); res != nil {
|
if res := obj.Get(val.ID).Data(); res != nil {
|
||||||
return e.fetch(ctx, res, doc)
|
return e.fetch(ctx, res, doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
case *sql.IfStatement:
|
case *sql.IfStatement:
|
||||||
|
@ -208,6 +229,12 @@ func (e *executor) fetchPaths(ctx context.Context, doc *data.Doc, exprs ...sql.E
|
||||||
}
|
}
|
||||||
case *sql.PartExpression:
|
case *sql.PartExpression:
|
||||||
switch val := val.Part.(type) {
|
switch val := val.Part.(type) {
|
||||||
|
case *sql.Param:
|
||||||
|
res, err := e.fetch(ctx, val, doc)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return e.fetchPaths(ctx, data.Consume(res), exprs...)
|
||||||
case *sql.Ident:
|
case *sql.Ident:
|
||||||
res, err := e.fetch(ctx, val, doc)
|
res, err := e.fetch(ctx, val, doc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -451,6 +451,368 @@ func TestSelect(t *testing.T) {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Convey("Select $thing from a direct `thing` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, person:test AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldResemble, &sql.Thing{"person", "test"})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id' parameter from a direct `thing` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, person:test.id AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldResemble, &sql.Thing{"person", "test"})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'name' parameter from a direct `thing` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, person:test.name AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id.name' parameter from a direct `thing` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, person:test.id.name AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id.id.id.name' parameter from a direct `thing` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, person:test.id.id.id.name AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select $param parameter from a direct `param` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
LET person = person:test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, $person.id AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 5)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[4].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("test").Data(), ShouldResemble, &sql.Thing{"person", "test"})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id' parameter from a direct `param` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
LET person = person:test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, $person.id AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 5)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[4].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("test").Data(), ShouldResemble, &sql.Thing{"person", "test"})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'name' parameter from a direct `param` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
LET person = person:test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, $person.name AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 5)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[4].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id.name' parameter from a direct `param` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
LET person = person:test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, $person.id.name AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 5)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[4].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id.id.id.name' parameter from a direct `param` record fetch", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
LET person = person:test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, $person.id.id.id.name AS test FROM tester;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 5)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[4].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.tb").Data(), ShouldEqual, "tester")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[4].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select $parent parameter from a subquery `param`", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, (SELECT $parent FROM tester LIMIT 1) AS test FROM person;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "person")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("name").Data(), ShouldEqual, "Tobias")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldResemble, map[string]interface{}{
|
||||||
|
"id": &sql.Thing{"person", "test"},
|
||||||
|
"meta": map[string]interface{}{
|
||||||
|
"id": "test",
|
||||||
|
"tb": "person",
|
||||||
|
},
|
||||||
|
"name": "Tobias",
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id' parameter from a subquery `param`", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, (SELECT $parent.id FROM tester LIMIT 1) AS test FROM person;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "person")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("name").Data(), ShouldEqual, "Tobias")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldResemble, &sql.Thing{"person", "test"})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'name' parameter from a subquery `param`", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, (SELECT $parent.name FROM tester LIMIT 1) AS test FROM person;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "person")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("name").Data(), ShouldEqual, "Tobias")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id.name' parameter from a subquery `param`", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, (SELECT $parent.id.name FROM tester LIMIT 1) AS test FROM person;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "person")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("name").Data(), ShouldEqual, "Tobias")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Select 'id.id.id.name' parameter from a subquery `param`", t, func() {
|
||||||
|
|
||||||
|
setupDB()
|
||||||
|
|
||||||
|
txt := `
|
||||||
|
USE NS test DB test;
|
||||||
|
CREATE tester:test;
|
||||||
|
CREATE person:test SET name="Tobias";
|
||||||
|
SELECT *, (SELECT $parent.id.id.id.name FROM tester LIMIT 1) AS test FROM person;
|
||||||
|
`
|
||||||
|
|
||||||
|
res, err := Execute(setupKV(), txt, nil)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(res, ShouldHaveLength, 4)
|
||||||
|
So(res[1].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[2].Result, ShouldHaveLength, 1)
|
||||||
|
So(res[3].Result, ShouldHaveLength, 1)
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.tb").Data(), ShouldEqual, "person")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("meta.id").Data(), ShouldEqual, "test")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("name").Data(), ShouldEqual, "Tobias")
|
||||||
|
So(data.Consume(res[3].Result[0]).Get("test").Data(), ShouldEqual, "Tobias")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
Convey("Filter using VOID to find records where the field is not set", t, func() {
|
Convey("Filter using VOID to find records where the field is not set", t, func() {
|
||||||
|
|
||||||
setupDB()
|
setupDB()
|
||||||
|
|
Loading…
Reference in a new issue