diff --git a/README.md b/README.md index 6e1f2b3d1a..f61ec5d34d 100644 --- a/README.md +++ b/README.md @@ -151,11 +151,13 @@ Expected response: ```json { - "data": [ - { - "_docID": "bae-91171025-ed21-50e3-b0dc-e31bccdfa1ab", - } - ] + "data": { + "create_User": [ + { + "_docID": "bae-91171025-ed21-50e3-b0dc-e31bccdfa1ab", + } + ] + } } ``` @@ -223,37 +225,39 @@ It returns a structure similar to the following, which contains the update paylo ```json { - "data": [ - { - "cid": "bafybeifhtfs6vgu7cwbhkojneh7gghwwinh5xzmf7nqkqqdebw5rqino7u", - "delta": "pGNhZ2UYH2RuYW1lY0JvYmZwb2ludHMYWmh2ZXJpZmllZPU=", - "height": 1, - "links": [ - { - "cid": "bafybeiet6foxcipesjurdqi4zpsgsiok5znqgw4oa5poef6qtiby5hlpzy", - "name": "age" - }, - { - "cid": "bafybeielahxy3r3ulykwoi5qalvkluojta4jlg6eyxvt7lbon3yd6ignby", - "name": "name" - }, - { - "cid": "bafybeia3tkpz52s3nx4uqadbm7t5tir6gagkvjkgipmxs2xcyzlkf4y4dm", - "name": "points" - }, - { - "cid": "bafybeia4off4javopmxcdyvr6fgb5clo7m5bblxic5sqr2vd52s6khyksm", - "name": "verified" - } - ] - } - ] + "data": { + "latestCommits": [ + { + "cid": "bafybeifhtfs6vgu7cwbhkojneh7gghwwinh5xzmf7nqkqqdebw5rqino7u", + "delta": "pGNhZ2UYH2RuYW1lY0JvYmZwb2ludHMYWmh2ZXJpZmllZPU=", + "height": 1, + "links": [ + { + "cid": "bafybeiet6foxcipesjurdqi4zpsgsiok5znqgw4oa5poef6qtiby5hlpzy", + "name": "age" + }, + { + "cid": "bafybeielahxy3r3ulykwoi5qalvkluojta4jlg6eyxvt7lbon3yd6ignby", + "name": "name" + }, + { + "cid": "bafybeia3tkpz52s3nx4uqadbm7t5tir6gagkvjkgipmxs2xcyzlkf4y4dm", + "name": "points" + }, + { + "cid": "bafybeia4off4javopmxcdyvr6fgb5clo7m5bblxic5sqr2vd52s6khyksm", + "name": "verified" + } + ] + } + ] + } } ``` Obtain a specific commit by its content identifier (`cid`): -```gql +```shell defradb client query ' query { commits(cid: "bafybeifhtfs6vgu7cwbhkojneh7gghwwinh5xzmf7nqkqqdebw5rqino7u") { diff --git a/docs/website/getting-started.md b/docs/website/getting-started.md index 739f27b893..ad1230fea6 100644 --- a/docs/website/getting-started.md +++ b/docs/website/getting-started.md @@ -153,31 +153,33 @@ It returns a structure similar to the following, which contains the update paylo ```json { - "data": [ - { - "cid": "bafybeifhtfs6vgu7cwbhkojneh7gghwwinh5xzmf7nqkqqdebw5rqino7u", - "delta": "pGNhZ2UYH2RuYW1lY0JvYmZwb2ludHMYWmh2ZXJpZmllZPU=", - "height": 1, - "links": [ - { - "cid": "bafybeiet6foxcipesjurdqi4zpsgsiok5znqgw4oa5poef6qtiby5hlpzy", - "name": "age" - }, - { - "cid": "bafybeielahxy3r3ulykwoi5qalvkluojta4jlg6eyxvt7lbon3yd6ignby", - "name": "name" - }, - { - "cid": "bafybeia3tkpz52s3nx4uqadbm7t5tir6gagkvjkgipmxs2xcyzlkf4y4dm", - "name": "points" - }, - { - "cid": "bafybeia4off4javopmxcdyvr6fgb5clo7m5bblxic5sqr2vd52s6khyksm", - "name": "verified" - } - ] - } - ] + "data": { + "latestCommits": [ + { + "cid": "bafybeifhtfs6vgu7cwbhkojneh7gghwwinh5xzmf7nqkqqdebw5rqino7u", + "delta": "pGNhZ2UYH2RuYW1lY0JvYmZwb2ludHMYWmh2ZXJpZmllZPU=", + "height": 1, + "links": [ + { + "cid": "bafybeiet6foxcipesjurdqi4zpsgsiok5znqgw4oa5poef6qtiby5hlpzy", + "name": "age" + }, + { + "cid": "bafybeielahxy3r3ulykwoi5qalvkluojta4jlg6eyxvt7lbon3yd6ignby", + "name": "name" + }, + { + "cid": "bafybeia3tkpz52s3nx4uqadbm7t5tir6gagkvjkgipmxs2xcyzlkf4y4dm", + "name": "points" + }, + { + "cid": "bafybeia4off4javopmxcdyvr6fgb5clo7m5bblxic5sqr2vd52s6khyksm", + "name": "verified" + } + ] + } + ] + } } ``` diff --git a/docs/website/guides/explain-systems.md b/docs/website/guides/explain-systems.md index a1d770fc2e..c185afd003 100644 --- a/docs/website/guides/explain-systems.md +++ b/docs/website/guides/explain-systems.md @@ -134,26 +134,24 @@ query @explain(type: execute) { ```json // Response -[ - { - "explain": { - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": 2, - "selectTopNode": { - "selectNode": { - "iterations": 2, - "filterMatches": 1, - "scanNode": { - "iterations": 2, - "docFetches": 2, - "filterMatches": 1 - } - } - } - } - } -] +{ + "explain": { + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": 2, + "selectTopNode": { + "selectNode": { + "iterations": 2, + "filterMatches": 1, + "scanNode": { + "iterations": 2, + "docFetches": 2, + "filterMatches": 1 + } + } + } + } +} ``` Because Execute Explain actually executes the plan, it will of course take more time to complete and return results than the Simple Explain. It will actually take slightly longer to execute than the non-explain counterpart, as it has the overhead of measuring and collecting information. diff --git a/docs/website/guides/schema-relationship.md b/docs/website/guides/schema-relationship.md index 5eb77dc8d4..073932970f 100644 --- a/docs/website/guides/schema-relationship.md +++ b/docs/website/guides/schema-relationship.md @@ -234,23 +234,25 @@ query { ```json // Results: -[ - { - "name": "Saadi Shirazi", - "dateOfBirth": "1210-07-23T03:46:56.647Z", - "authoredBooks": [ - { - "name": "Gulistan", - "genre": "Poetry", - "description": "Persian poetry of ideas" - }, - { - "name": "Bustan", - "genre": "Poetry" - } - ] - } -] +{ + "Author": [ + { + "name": "Saadi Shirazi", + "dateOfBirth": "1210-07-23T03:46:56.647Z", + "authoredBooks": [ + { + "name": "Gulistan", + "genre": "Poetry", + "description": "Persian poetry of ideas" + }, + { + "name": "Bustan", + "genre": "Poetry" + } + ] + } + ] +} ``` ```graphql @@ -268,24 +270,26 @@ query { ```json // Results: -[ - { - "name": "Gulistan", - "genre": "Poetry", - "Author": { - "name": "Saadi Shirazi", - "dateOfBirth": "1210-07-23T03:46:56.647Z", - } - }, - { - "name": "Bustan", - "genre": "Poetry", - "Author": { - "name": "Saadi Shirazi", - "dateOfBirth": "1210-07-23T03:46:56.647Z", +{ + "Book": [ + { + "name": "Gulistan", + "genre": "Poetry", + "Author": { + "name": "Saadi Shirazi", + "dateOfBirth": "1210-07-23T03:46:56.647Z", + } + }, + { + "name": "Bustan", + "genre": "Poetry", + "Author": { + "name": "Saadi Shirazi", + "dateOfBirth": "1210-07-23T03:46:56.647Z", + } } - } -] + ] +} ``` ```graphql @@ -303,18 +307,20 @@ query { ```json // Results: -[ - { - "name": "Saadi Shirazi", - "dateOfBirth": "1210-07-23T03:46:56.647Z", - "authoredBooks": [ - { - "name": "Gulistan", - "genre": "Poetry" - } - ] - } -] +{ + "Author": [ + { + "name": "Saadi Shirazi", + "dateOfBirth": "1210-07-23T03:46:56.647Z", + "authoredBooks": [ + { + "name": "Gulistan", + "genre": "Poetry" + } + ] + } + ] +} ``` ```graphql @@ -330,12 +336,14 @@ query { ```json // Results: -[ - { - "name": "Saadi Shirazi", - "dateOfBirth": "1210-07-23T03:46:56.647Z" - } -] +{ + "Author": [ + { + "name": "Saadi Shirazi", + "dateOfBirth": "1210-07-23T03:46:56.647Z" + } + ] +} ``` Note: diff --git a/http/handler_ccip_test.go b/http/handler_ccip_test.go index d35a910161..43797b622d 100644 --- a/http/handler_ccip_test.go +++ b/http/handler_ccip_test.go @@ -67,7 +67,7 @@ func TestCCIPGet_WithValidData(t *testing.T) { resHex, err := hex.DecodeString(strings.TrimPrefix(ccipRes.Data, "0x")) require.NoError(t, err) - assert.JSONEq(t, `{"data": [{"name": "bob"}]}`, string(resHex)) + assert.JSONEq(t, `{"data": {"User": [{"name": "bob"}]}}`, string(resHex)) } func TestCCIPGet_WithSubscription(t *testing.T) { @@ -153,7 +153,7 @@ func TestCCIPPost_WithValidData(t *testing.T) { resHex, err := hex.DecodeString(strings.TrimPrefix(ccipRes.Data, "0x")) require.NoError(t, err) - assert.JSONEq(t, `{"data": [{"name": "bob"}]}`, string(resHex)) + assert.JSONEq(t, `{"data": {"User": [{"name": "bob"}]}}`, string(resHex)) } func TestCCIPPost_WithInvalidGraphQLRequest(t *testing.T) { diff --git a/http/handler_store.go b/http/handler_store.go index de534a8c1d..f9438d443f 100644 --- a/http/handler_store.go +++ b/http/handler_store.go @@ -267,6 +267,7 @@ func (res *GraphQLResponse) UnmarshalJSON(data []byte) error { if err := dec.Decode(&out); err != nil { return err } + res.Data = out["data"] // fix errors type to match tests switch t := out["errors"].(type) { @@ -278,20 +279,6 @@ func (res *GraphQLResponse) UnmarshalJSON(data []byte) error { res.Errors = nil } - // fix data type to match tests - switch t := out["data"].(type) { - case []any: - var fixed []map[string]any - for _, v := range t { - fixed = append(fixed, v.(map[string]any)) - } - res.Data = fixed - case map[string]any: - res.Data = t - default: - res.Data = []map[string]any{} - } - return nil } diff --git a/internal/db/collection_update.go b/internal/db/collection_update.go index 612d47a883..d29e562977 100644 --- a/internal/db/collection_update.go +++ b/internal/db/collection_update.go @@ -259,15 +259,7 @@ func (c *collection) makeSelectionPlan( txn, ) - return planner.MakePlan(&request.Request{ - Queries: []*request.OperationDefinition{ - { - Selections: []request.Selection{ - slct, - }, - }, - }, - }) + return planner.MakeSelectionPlan(slct) } func (c *collection) makeSelectLocal(filter immutable.Option[request.Filter]) (*request.Select, error) { diff --git a/internal/db/request.go b/internal/db/request.go index e5ba3d5cf5..b7d77185fb 100644 --- a/internal/db/request.go +++ b/internal/db/request.go @@ -53,9 +53,7 @@ func (db *db) execRequest(ctx context.Context, request string) *client.RequestRe results, err := planner.RunRequest(ctx, parsedRequest) if err != nil { res.GQL.Errors = []error{err} - return res } - res.GQL.Data = results return res } diff --git a/internal/db/subscriptions.go b/internal/db/subscriptions.go index 491ae44468..03fe41cc25 100644 --- a/internal/db/subscriptions.go +++ b/internal/db/subscriptions.go @@ -70,17 +70,16 @@ func (db *db) handleSubscription(ctx context.Context, r *request.Request) (<-cha p := planner.New(ctx, identity, db.acp, db, txn) s := subRequest.ToSelect(evt.DocID, evt.Cid.String()) - result, err := p.RunSubscriptionRequest(ctx, s) + result, err := p.RunSelection(ctx, s) if err == nil && len(result) == 0 { txn.Discard(ctx) continue // Don't send anything back to the client if the request yields an empty dataset. } - res := client.GQLResult{ - Data: result, - } + res := client.GQLResult{} if err != nil { res.Errors = []error{err} } + res.Data = result select { case <-ctx.Done(): diff --git a/internal/planner/explain.go b/internal/planner/explain.go index 34c3b3b644..1f17968489 100644 --- a/internal/planner/explain.go +++ b/internal/planner/explain.go @@ -344,18 +344,16 @@ func collectExecuteExplainInfo(executedPlan planNode) (map[string]any, error) { func (p *Planner) executeAndExplainRequest( _ context.Context, plan planNode, -) ([]map[string]any, error) { +) (map[string]any, error) { executionSuccess := false planExecutions := uint64(0) if err := plan.Start(); err != nil { - return []map[string]any{ - { - request.ExplainLabel: map[string]any{ - "executionSuccess": executionSuccess, - "executionErrors": []string{"plan failed to start"}, - "planExecutions": planExecutions, - }, + return map[string]any{ + request.ExplainLabel: map[string]any{ + "executionSuccess": executionSuccess, + "executionErrors": []string{"plan failed to start"}, + "planExecutions": planExecutions, }, }, nil } @@ -363,16 +361,14 @@ func (p *Planner) executeAndExplainRequest( next, err := plan.Next() planExecutions++ if err != nil { - return []map[string]any{ - { - request.ExplainLabel: map[string]any{ - "executionSuccess": executionSuccess, - "executionErrors": []string{ - "failure at plan execution count: " + strconv.FormatUint(planExecutions, 10), - err.Error(), - }, - "planExecutions": planExecutions, + return map[string]any{ + request.ExplainLabel: map[string]any{ + "executionSuccess": executionSuccess, + "executionErrors": []string{ + "failure at plan execution count: " + strconv.FormatUint(planExecutions, 10), + err.Error(), }, + "planExecutions": planExecutions, }, }, nil } @@ -388,17 +384,15 @@ func (p *Planner) executeAndExplainRequest( planExecutions++ if err != nil { - return []map[string]any{ - { - request.ExplainLabel: map[string]any{ - "executionSuccess": executionSuccess, - "executionErrors": []string{ - "failure at plan execution count: " + strconv.FormatUint(planExecutions, 10), - err.Error(), - }, - "planExecutions": planExecutions, - "sizeOfResultSoFar": len(docs), + return map[string]any{ + request.ExplainLabel: map[string]any{ + "executionSuccess": executionSuccess, + "executionErrors": []string{ + "failure at plan execution count: " + strconv.FormatUint(planExecutions, 10), + err.Error(), }, + "planExecutions": planExecutions, + "sizeOfResultSoFar": len(docs), }, }, nil } @@ -414,10 +408,8 @@ func (p *Planner) executeAndExplainRequest( executeExplain["planExecutions"] = planExecutions executeExplain["sizeOfResult"] = len(docs) - return []map[string]any{ - { - request.ExplainLabel: executeExplain, - }, + return map[string]any{ + request.ExplainLabel: executeExplain, }, err } @@ -426,7 +418,7 @@ func (p *Planner) explainRequest( ctx context.Context, plan planNode, explainType request.ExplainType, -) ([]map[string]any, error) { +) (map[string]any, error) { switch explainType { case request.SimpleExplain: // walks through the plan graph, and outputs the concrete planNodes that should @@ -436,10 +428,8 @@ func (p *Planner) explainRequest( return nil, err } - explainResult := []map[string]any{ - { - request.ExplainLabel: explainGraph, - }, + explainResult := map[string]any{ + request.ExplainLabel: explainGraph, } return explainResult, nil @@ -452,10 +442,8 @@ func (p *Planner) explainRequest( return nil, err } - explainResult := []map[string]any{ - { - request.ExplainLabel: explainGraph, - }, + explainResult := map[string]any{ + request.ExplainLabel: explainGraph, } return explainResult, nil diff --git a/internal/planner/mapper/errors.go b/internal/planner/mapper/errors.go index b7477274a1..43f7f56a7a 100644 --- a/internal/planner/mapper/errors.go +++ b/internal/planner/mapper/errors.go @@ -23,6 +23,7 @@ var ( ErrFailedToFindHostField = errors.New("failed to find host field") ErrInvalidFieldIndex = errors.New("given field doesn't have any indexes") ErrMissingSelect = errors.New("missing target select field") + ErrInvalidSelect = errors.New("select type is invalid") ) func NewErrInvalidFieldToGroupBy(field string) error { diff --git a/internal/planner/mapper/mapper.go b/internal/planner/mapper/mapper.go index 195e895ffd..7542449727 100644 --- a/internal/planner/mapper/mapper.go +++ b/internal/planner/mapper/mapper.go @@ -41,7 +41,54 @@ const ( CommitSelection ) -// ToSelect converts the given [parser.Select] into a [Select]. +// ToOperation converts the given [request.OperationDefinition] into an [Operation]. +// +// In the process of doing so it will construct the document map required to access the data +// yielded by the [Operation]. +func ToOperation( + ctx context.Context, + store client.Store, + operationRequest *request.OperationDefinition, +) (*Operation, error) { + operation := &Operation{ + DocumentMapping: core.NewDocumentMapping(), + } + + for i, s := range operationRequest.Selections { + switch t := s.(type) { + case *request.CommitSelect: + s, err := toCommitSelect(ctx, store, t, i) + if err != nil { + return nil, err + } + operation.CommitSelects = append(operation.CommitSelects, s) + operation.addSelection(i, t.Field, s.Select) + + case *request.Select: + s, err := toSelect(ctx, store, ObjectSelection, i, t, "") + if err != nil { + return nil, err + } + operation.Selects = append(operation.Selects, s) + operation.addSelection(i, t.Field, *s) + + case *request.ObjectMutation: + m, err := toMutation(ctx, store, t, i) + if err != nil { + return nil, err + } + operation.Mutations = append(operation.Mutations, m) + operation.addSelection(i, t.Field, m.Select) + + default: + return nil, ErrInvalidSelect + } + } + + return operation, nil +} + +// ToSelect converts the given [request.Select] into a [Select]. // // In the process of doing so it will construct the document map required to access the data // yielded by the [Select]. @@ -1142,7 +1189,20 @@ func ToCommitSelect( store client.Store, selectRequest *request.CommitSelect, ) (*CommitSelect, error) { - underlyingSelect, err := ToSelect(ctx, store, CommitSelection, selectRequest.ToSelect()) + return toCommitSelect(ctx, store, selectRequest, 0) +} + +// toCommitSelect converts the given [request.CommitSelect] into a [CommitSelect]. +// +// In the process of doing so it will construct the document map required to access the data +// yielded by the [Select] embedded in the [CommitSelect]. +func toCommitSelect( + ctx context.Context, + store client.Store, + selectRequest *request.CommitSelect, + thisIndex int, +) (*CommitSelect, error) { + underlyingSelect, err := toSelect(ctx, store, CommitSelection, thisIndex, selectRequest.ToSelect(), "") if err != nil { return nil, err } @@ -1160,11 +1220,23 @@ func ToCommitSelect( // In the process of doing so it will construct the document map required to access the data // yielded by the [Select] embedded in the [Mutation]. func ToMutation(ctx context.Context, store client.Store, mutationRequest *request.ObjectMutation) (*Mutation, error) { - underlyingSelect, err := ToSelect(ctx, store, ObjectSelection, mutationRequest.ToSelect()) + return toMutation(ctx, store, mutationRequest, 0) +} + +// toMutation converts the given [request.Mutation] into a [Mutation]. +// +// In the process of doing so it will construct the document map required to access the data +// yielded by the [Select] embedded in the [Mutation]. +func toMutation( + ctx context.Context, + store client.Store, + mutationRequest *request.ObjectMutation, + thisIndex int, +) (*Mutation, error) { + underlyingSelect, err := toSelect(ctx, store, ObjectSelection, thisIndex, mutationRequest.ToSelect(), "") if err != nil { return nil, err } - return &Mutation{ Select: *underlyingSelect, Type: MutationType(mutationRequest.Type), diff --git a/internal/planner/mapper/operation.go b/internal/planner/mapper/operation.go new file mode 100644 index 0000000000..9748a9e90b --- /dev/null +++ b/internal/planner/mapper/operation.go @@ -0,0 +1,46 @@ +// Copyright 2024 Democratized Data Foundation +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package mapper + +import ( + "github.com/sourcenetwork/defradb/client/request" + "github.com/sourcenetwork/defradb/internal/core" +) + +// Operation represents an operation such as query or mutation. +// +// It wraps child Selects belonging to this operation. +type Operation struct { + // The document mapping for this select, describing how items yielded + // for this select can be accessed and rendered. + *core.DocumentMapping + + // Selects is the list of selections in the operation. + Selects []*Select + + // Mutations is the list of mutations in the operation. + Mutations []*Mutation + + // CommitSelects is the list of commit selections in the operation. + CommitSelects []*CommitSelect +} + +// addSelection adds a new selection to the operation's document mapping. +// The request.Field is used as the key for the core.RenderKey and the Select +// document mapping is added as a child field. +func (o *Operation) addSelection(i int, f request.Field, s Select) { + o.DocumentMapping.Add(i, s.Name) + o.DocumentMapping.SetChildAt(i, s.DocumentMapping) + o.DocumentMapping.RenderKeys = append(o.DocumentMapping.RenderKeys, core.RenderKey{ + Key: getRenderKey(&f), + Index: s.Index, + }) +} diff --git a/internal/planner/operation.go b/internal/planner/operation.go new file mode 100644 index 0000000000..934fe2d4b4 --- /dev/null +++ b/internal/planner/operation.go @@ -0,0 +1,167 @@ +// Copyright 2024 Democratized Data Foundation +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package planner + +import ( + "github.com/sourcenetwork/defradb/client/request" + "github.com/sourcenetwork/defradb/internal/core" + "github.com/sourcenetwork/defradb/internal/planner/mapper" +) + +const operationNodeKind string = "operationNode" + +// operationNode is the top level node for operations with +// one or more child selections, such as queries or mutations. +type operationNode struct { + documentIterator + docMapper + + children map[int]planNode + isDone bool +} + +func (n *operationNode) Spans(spans core.Spans) { + for _, child := range n.children { + child.Spans(spans) + } +} + +func (n *operationNode) Kind() string { + return operationNodeKind +} + +func (n *operationNode) Init() error { + n.isDone = false + n.currentValue = core.Doc{} + + for _, child := range n.children { + err := child.Init() + if err != nil { + return err + } + } + return nil +} + +func (n *operationNode) Start() error { + for _, child := range n.children { + err := child.Start() + if err != nil { + return err + } + } + return nil +} + +func (n *operationNode) Close() error { + for _, child := range n.children { + err := child.Close() + if err != nil { + return err + } + } + return nil +} + +func (n *operationNode) Source() planNode { + return nil +} + +func (p *operationNode) Children() []planNode { + children := make([]planNode, 0, len(p.children)) + for _, child := range p.children { + children = append(children, child) + } + return children +} + +func (n *operationNode) Next() (bool, error) { + if n.isDone { + return false, nil + } + + n.currentValue = n.documentMapping.NewDoc() + for i, child := range n.children { + switch child.(type) { + case *topLevelNode: + hasChild, err := child.Next() + if err != nil { + return false, err + } + if !hasChild { + return false, ErrMissingChildValue + } + n.currentValue.Fields[i] = child.Value().Fields[0] + + default: + var docs []core.Doc + for { + hasChild, err := child.Next() + if err != nil { + return false, err + } + if !hasChild { + break + } + docs = append(docs, child.Value()) + } + n.currentValue.Fields[i] = docs + } + } + + n.isDone = true + return true, nil +} + +// Operation creates a new operationNode using the given Selects. +func (p *Planner) Operation(operation *mapper.Operation) (*operationNode, error) { + children := make(map[int]planNode) + + for _, s := range operation.Selects { + if _, isAgg := request.Aggregates[s.Name]; isAgg { + // If this Select is an aggregate, then it must be a top-level + // aggregate and we need to resolve it within the context of a + // top-level node. + child, err := p.Top(s) + if err != nil { + return nil, err + } + children[s.Index] = child + } else { + child, err := p.Select(s) + if err != nil { + return nil, err + } + children[s.Index] = child + } + } + + for _, m := range operation.Mutations { + child, err := p.newObjectMutationPlan(m) + if err != nil { + return nil, err + } + children[m.Index] = child + } + + for _, s := range operation.CommitSelects { + child, err := p.CommitSelect(s) + if err != nil { + return nil, err + } + children[s.Index] = child + } + + return &operationNode{ + docMapper: docMapper{operation.DocumentMapping}, + children: children, + }, nil +} diff --git a/internal/planner/operations.go b/internal/planner/operations.go index 59aa00a3c3..e08ebae5c3 100644 --- a/internal/planner/operations.go +++ b/internal/planner/operations.go @@ -37,6 +37,7 @@ var ( _ MultiNode = (*parallelNode)(nil) _ MultiNode = (*topLevelNode)(nil) + _ MultiNode = (*operationNode)(nil) ) // type joinNode struct { diff --git a/internal/planner/planner.go b/internal/planner/planner.go index db7b0510ab..e6f67668ea 100644 --- a/internal/planner/planner.go +++ b/internal/planner/planner.go @@ -110,56 +110,6 @@ func New( } } -func (p *Planner) newPlan(stmt any) (planNode, error) { - switch n := stmt.(type) { - case *request.Request: - if len(n.Queries) > 0 { - return p.newPlan(n.Queries[0]) // @todo, handle multiple query operation statements - } else if len(n.Mutations) > 0 { - return p.newPlan(n.Mutations[0]) // @todo: handle multiple mutation operation statements - } else { - return nil, ErrMissingQueryOrMutation - } - - case *request.OperationDefinition: - if len(n.Selections) == 0 { - return nil, ErrOperationDefinitionMissingSelection - } - return p.newPlan(n.Selections[0]) - - case *request.Select: - m, err := mapper.ToSelect(p.ctx, p.db, mapper.ObjectSelection, n) - if err != nil { - return nil, err - } - - if _, isAgg := request.Aggregates[n.Name]; isAgg { - // If this Select is an aggregate, then it must be a top-level - // aggregate and we need to resolve it within the context of a - // top-level node. - return p.Top(m) - } - - return p.Select(m) - - case *request.CommitSelect: - m, err := mapper.ToCommitSelect(p.ctx, p.db, n) - if err != nil { - return nil, err - } - return p.CommitSelect(m) - - case *request.ObjectMutation: - m, err := mapper.ToMutation(p.ctx, p.db, n) - if err != nil { - return nil, err - } - return p.newObjectMutationPlan(m) - } - - return nil, client.NewErrUnhandledType("statement", stmt) -} - func (p *Planner) newObjectMutationPlan(stmt *mapper.Mutation) (planNode, error) { switch stmt.Type { case mapper.CreateObjects: @@ -176,23 +126,6 @@ func (p *Planner) newObjectMutationPlan(stmt *mapper.Mutation) (planNode, error) } } -// makePlan creates a new plan from the parsed data, optimizes the plan and returns -// it. The caller of makePlan is also responsible of calling Close() on the plan to -// free it's resources. -func (p *Planner) makePlan(stmt any) (planNode, error) { - planNode, err := p.newPlan(stmt) - if err != nil { - return nil, err - } - - err = p.optimizePlan(planNode) - if err != nil { - return nil, err - } - - return planNode, err -} - // optimizePlan optimizes the plan using plan expansion and wiring. func (p *Planner) optimizePlan(planNode planNode) error { err := p.expandPlan(planNode, nil) @@ -555,12 +488,25 @@ func (p *Planner) executeRequest( return docs, err } +// RunSelection runs a selection and returns the result(s). +func (p *Planner) RunSelection( + ctx context.Context, + sel *request.Select, +) (map[string]any, error) { + req := &request.Request{ + Queries: []*request.OperationDefinition{{ + Selections: []request.Selection{sel}, + }}, + } + return p.RunRequest(ctx, req) +} + // RunRequest classifies the type of request to run, runs it, and then returns the result(s). func (p *Planner) RunRequest( ctx context.Context, req *request.Request, -) (result []map[string]any, err error) { - planNode, err := p.makePlan(req) +) (map[string]any, error) { + planNode, err := p.MakePlan(req) if err != nil { return nil, err } @@ -590,35 +536,36 @@ func (p *Planner) RunRequest( } // This won't / should NOT execute if it's any kind of explain request. - return p.executeRequest(ctx, planNode) -} - -// RunSubscriptionRequest plans a request specific to a subscription and returns the result. -func (p *Planner) RunSubscriptionRequest( - ctx context.Context, - request *request.Select, -) (result []map[string]any, err error) { - planNode, err := p.makePlan(request) + res, err := p.executeRequest(ctx, planNode) if err != nil { return nil, err } - defer func() { - if e := planNode.Close(); e != nil { - err = NewErrFailedToClosePlan(e, "running subscription request") - } - }() + if len(res) > 0 { + return res[0], nil + } - err = planNode.Init() + return nil, nil +} + +// MakeSelectionPlan makes a plan for a single selection. +// +// Note: Caller is responsible to call the `Close()` method to free the allocated +// resources of the returned plan. +func (p *Planner) MakeSelectionPlan(selection *request.Select) (planNode, error) { + s, err := mapper.ToSelect(p.ctx, p.db, mapper.ObjectSelection, selection) if err != nil { return nil, err } - - data, err := p.executeRequest(ctx, planNode) + planNode, err := p.Select(s) + if err != nil { + return nil, err + } + err = p.optimizePlan(planNode) if err != nil { return nil, err } - return data, nil + return planNode, err } // MakePlan makes a plan from the parsed request. @@ -627,6 +574,28 @@ func (p *Planner) RunSubscriptionRequest( // resources of the returned plan. // // @TODO {defradb/issues/368}: Test this exported function. -func (p *Planner) MakePlan(request *request.Request) (planNode, error) { - return p.makePlan(request) +func (p *Planner) MakePlan(req *request.Request) (planNode, error) { + // TODO handle multiple operation statements + // https://github.com/sourcenetwork/defradb/issues/1395 + var operation *request.OperationDefinition + if len(req.Mutations) > 0 { + operation = req.Mutations[0] + } else if len(req.Queries) > 0 { + operation = req.Queries[0] + } else { + return nil, ErrMissingQueryOrMutation + } + m, err := mapper.ToOperation(p.ctx, p.db, operation) + if err != nil { + return nil, err + } + planNode, err := p.Operation(m) + if err != nil { + return nil, err + } + err = p.optimizePlan(planNode) + if err != nil { + return nil, err + } + return planNode, err } diff --git a/tests/integration/acp/index/create_test.go b/tests/integration/acp/index/create_test.go index c75e51bc4e..da9e9b96b9 100644 --- a/tests/integration/acp/index/create_test.go +++ b/tests/integration/acp/index/create_test.go @@ -56,7 +56,9 @@ func TestACP_IndexCreateWithSeparateRequest_OnCollectionWithPolicy_NoError(t *te } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -95,6 +97,9 @@ func TestACP_IndexCreateWithDirective_OnCollectionWithPolicy_NoError(t *testing. age } }`, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/acp/index/query_test.go b/tests/integration/acp/index/query_test.go index e2818708b8..3fafeb4b10 100644 --- a/tests/integration/acp/index/query_test.go +++ b/tests/integration/acp/index/query_test.go @@ -60,9 +60,9 @@ func TestACPWithIndex_UponQueryingPrivateDocWithoutIdentity_ShouldNotFetch(t *te name } }`, - Results: []map[string]any{ - { - "name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "Shahzad"}, }, }, }, @@ -115,12 +115,14 @@ func TestACPWithIndex_UponQueryingPrivateDocWithIdentity_ShouldFetch(t *testing. name } }`, - Results: []map[string]any{ - { - "name": "Islam", - }, - { - "name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Islam", + }, + { + "name": "Shahzad", + }, }, }, }, @@ -173,9 +175,11 @@ func TestACPWithIndex_UponQueryingPrivateDocWithWrongIdentity_ShouldNotFetch(t * name } }`, - Results: []map[string]any{ - { - "name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + }, }, }, }, diff --git a/tests/integration/acp/index/query_with_relation_test.go b/tests/integration/acp/index/query_with_relation_test.go index 925d35cb4f..5a406e6575 100644 --- a/tests/integration/acp/index/query_with_relation_test.go +++ b/tests/integration/acp/index/query_with_relation_test.go @@ -111,12 +111,14 @@ func TestACPWithIndex_UponQueryingPrivateOneToManyRelatedDocWithoutIdentity_Shou } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -146,23 +148,25 @@ func TestACPWithIndex_UponQueryingPrivateOneToManyRelatedDocWithIdentity_ShouldF } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", - }, - { - "name": "A Time for Mercy", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "A Time for Mercy", + }, }, }, - }, - { - "name": "Cornelia Funke", - "published": []map[string]any{ - { - "name": "Theif Lord", + { + "name": "Cornelia Funke", + "published": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, }, @@ -192,12 +196,14 @@ func TestACPWithIndex_UponQueryingPrivateOneToManyRelatedDocWithWrongIdentity_Sh } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -226,11 +232,13 @@ func TestACPWithIndex_UponQueryingPrivateManyToOneRelatedDocWithoutIdentity_Shou } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -259,23 +267,25 @@ func TestACPWithIndex_UponQueryingPrivateManyToOneRelatedDocWithIdentity_ShouldF } } }`, - Results: []map[string]any{ - { - "name": "Theif Lord", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Theif Lord", + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, - }, - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "A Time for Mercy", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -304,11 +314,13 @@ func TestACPWithIndex_UponQueryingPrivateManyToOneRelatedDocWithWrongIdentity_Sh } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/acp/p2p/replicator_test.go b/tests/integration/acp/p2p/replicator_test.go index 169e682658..8afaafebc0 100644 --- a/tests/integration/acp/p2p/replicator_test.go +++ b/tests/integration/acp/p2p/replicator_test.go @@ -157,9 +157,11 @@ func TestACP_P2POneToOneReplicatorWithPermissionedCollection_SourceHubACP(t *tes } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -172,7 +174,9 @@ func TestACP_P2POneToOneReplicatorWithPermissionedCollection_SourceHubACP(t *tes } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.Request{ // Ensure that the document is hidden on all nodes to unauthorized actors @@ -184,7 +188,9 @@ func TestACP_P2POneToOneReplicatorWithPermissionedCollection_SourceHubACP(t *tes } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/acp/p2p/subscribe_test.go b/tests/integration/acp/p2p/subscribe_test.go index 4e8cf4cc2e..e95fbaca97 100644 --- a/tests/integration/acp/p2p/subscribe_test.go +++ b/tests/integration/acp/p2p/subscribe_test.go @@ -179,9 +179,11 @@ func TestACP_P2PSubscribeAddGetSingleWithPermissionedCollection_SourceHubACP(t * } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -194,7 +196,9 @@ func TestACP_P2PSubscribeAddGetSingleWithPermissionedCollection_SourceHubACP(t * } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.Request{ // Ensure that the document is hidden on all nodes to unauthorized actors @@ -206,7 +210,9 @@ func TestACP_P2PSubscribeAddGetSingleWithPermissionedCollection_SourceHubACP(t * } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/acp/query/avg_test.go b/tests/integration/acp/query/avg_test.go index 425b6e0943..34b03de6ea 100644 --- a/tests/integration/acp/query/avg_test.go +++ b/tests/integration/acp/query/avg_test.go @@ -31,11 +31,9 @@ func TestACP_QueryAverageWithoutIdentity(t *testing.T) { _avg(Employee: {field: salary}) } `, - Results: []map[string]any{ - { - // 2 public employees, 1 with salary 10k, 1 with salary 20k - "_avg": int(15000), - }, + Results: map[string]any{ + // 2 public employees, 1 with salary 10k, 1 with salary 20k + "_avg": int(15000), }, }, }, @@ -58,11 +56,9 @@ func TestACP_QueryAverageWithIdentity(t *testing.T) { _avg(Employee: {field: salary}) } `, - Results: []map[string]any{ - { - // 4 employees with salaries 10k, 20k, 30k, 40k - "_avg": int(25000), - }, + Results: map[string]any{ + // 4 employees with salaries 10k, 20k, 30k, 40k + "_avg": int(25000), }, }, }, @@ -85,11 +81,9 @@ func TestACP_QueryAverageWithWrongIdentity(t *testing.T) { _avg(Employee: {field: salary}) } `, - Results: []map[string]any{ - { - // 2 public employees, 1 with salary 10k, 1 with salary 20k - "_avg": int(15000), - }, + Results: map[string]any{ + // 2 public employees, 1 with salary 10k, 1 with salary 20k + "_avg": int(15000), }, }, }, diff --git a/tests/integration/acp/query/count_test.go b/tests/integration/acp/query/count_test.go index 33bc053a60..e5f867b3d5 100644 --- a/tests/integration/acp/query/count_test.go +++ b/tests/integration/acp/query/count_test.go @@ -31,10 +31,8 @@ func TestACP_QueryCountDocumentsWithoutIdentity(t *testing.T) { _count(Employee: {}) } `, - Results: []map[string]any{ - { - "_count": int(2), - }, + Results: map[string]any{ + "_count": int(2), }, }, }, @@ -58,10 +56,12 @@ func TestACP_QueryCountRelatedObjectsWithoutIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - // 1 of 2 companies is public and has 1 public employee out of 2 - "_count": int(1), + Results: map[string]any{ + "Company": []map[string]any{ + { + // 1 of 2 companies is public and has 1 public employee out of 2 + "_count": int(1), + }, }, }, }, @@ -85,10 +85,8 @@ func TestACP_QueryCountDocumentsWithIdentity(t *testing.T) { _count(Employee: {}) } `, - Results: []map[string]any{ - { - "_count": int(4), - }, + Results: map[string]any{ + "_count": int(4), }, }, }, @@ -113,12 +111,14 @@ func TestACP_QueryCountRelatedObjectsWithIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_count": int(2), - }, - { - "_count": int(2), + Results: map[string]any{ + "Company": []map[string]any{ + { + "_count": int(2), + }, + { + "_count": int(2), + }, }, }, }, @@ -142,10 +142,8 @@ func TestACP_QueryCountDocumentsWithWrongIdentity(t *testing.T) { _count(Employee: {}) } `, - Results: []map[string]any{ - { - "_count": int(2), - }, + Results: map[string]any{ + "_count": int(2), }, }, }, @@ -170,10 +168,12 @@ func TestACP_QueryCountRelatedObjectsWithWrongIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - // 1 of 2 companies is public and has 1 public employee out of 2 - "_count": int(1), + Results: map[string]any{ + "Company": []map[string]any{ + { + // 1 of 2 companies is public and has 1 public employee out of 2 + "_count": int(1), + }, }, }, }, diff --git a/tests/integration/acp/query/relation_objects_test.go b/tests/integration/acp/query/relation_objects_test.go index 92deebb788..afbc014c08 100644 --- a/tests/integration/acp/query/relation_objects_test.go +++ b/tests/integration/acp/query/relation_objects_test.go @@ -36,14 +36,16 @@ func TestACP_QueryManyToOneRelationObjectsWithoutIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "PubEmp in PubCompany", - "company": map[string]any{"name": "Public Company"}, - }, - { - "name": "PubEmp in PrivateCompany", - "company": nil, + Results: map[string]any{ + "Employee": []map[string]any{ + { + "name": "PubEmp in PubCompany", + "company": map[string]any{"name": "Public Company"}, + }, + { + "name": "PubEmp in PrivateCompany", + "company": nil, + }, }, }, }, @@ -71,11 +73,13 @@ func TestACP_QueryOneToManyRelationObjectsWithoutIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Public Company", - "employees": []map[string]any{ - {"name": "PubEmp in PubCompany"}, + Results: map[string]any{ + "Company": []map[string]any{ + { + "name": "Public Company", + "employees": []map[string]any{ + {"name": "PubEmp in PubCompany"}, + }, }, }, }, @@ -105,22 +109,24 @@ func TestACP_QueryManyToOneRelationObjectsWithIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "PrivateEmp in PubCompany", - "company": map[string]any{"name": "Public Company"}, - }, - { - "name": "PrivateEmp in PrivateCompany", - "company": map[string]any{"name": "Private Company"}, - }, - { - "name": "PubEmp in PubCompany", - "company": map[string]any{"name": "Public Company"}, - }, - { - "name": "PubEmp in PrivateCompany", - "company": map[string]any{"name": "Private Company"}, + Results: map[string]any{ + "Employee": []map[string]any{ + { + "name": "PrivateEmp in PubCompany", + "company": map[string]any{"name": "Public Company"}, + }, + { + "name": "PrivateEmp in PrivateCompany", + "company": map[string]any{"name": "Private Company"}, + }, + { + "name": "PubEmp in PubCompany", + "company": map[string]any{"name": "Public Company"}, + }, + { + "name": "PubEmp in PrivateCompany", + "company": map[string]any{"name": "Private Company"}, + }, }, }, }, @@ -149,19 +155,21 @@ func TestACP_QueryOneToManyRelationObjectsWithIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Public Company", - "employees": []map[string]any{ - {"name": "PrivateEmp in PubCompany"}, - {"name": "PubEmp in PubCompany"}, + Results: map[string]any{ + "Company": []map[string]any{ + { + "name": "Public Company", + "employees": []map[string]any{ + {"name": "PrivateEmp in PubCompany"}, + {"name": "PubEmp in PubCompany"}, + }, }, - }, - { - "name": "Private Company", - "employees": []map[string]any{ - {"name": "PrivateEmp in PrivateCompany"}, - {"name": "PubEmp in PrivateCompany"}, + { + "name": "Private Company", + "employees": []map[string]any{ + {"name": "PrivateEmp in PrivateCompany"}, + {"name": "PubEmp in PrivateCompany"}, + }, }, }, }, @@ -191,14 +199,16 @@ func TestACP_QueryManyToOneRelationObjectsWithWrongIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "PubEmp in PubCompany", - "company": map[string]any{"name": "Public Company"}, - }, - { - "name": "PubEmp in PrivateCompany", - "company": nil, + Results: map[string]any{ + "Employee": []map[string]any{ + { + "name": "PubEmp in PubCompany", + "company": map[string]any{"name": "Public Company"}, + }, + { + "name": "PubEmp in PrivateCompany", + "company": nil, + }, }, }, }, @@ -227,11 +237,13 @@ func TestACP_QueryOneToManyRelationObjectsWithWrongIdentity(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Public Company", - "employees": []map[string]any{ - {"name": "PubEmp in PubCompany"}, + Results: map[string]any{ + "Company": []map[string]any{ + { + "name": "Public Company", + "employees": []map[string]any{ + {"name": "PubEmp in PubCompany"}, + }, }, }, }, diff --git a/tests/integration/acp/register_and_delete_test.go b/tests/integration/acp/register_and_delete_test.go index c5a0c882ca..e30388bd76 100644 --- a/tests/integration/acp/register_and_delete_test.go +++ b/tests/integration/acp/register_and_delete_test.go @@ -104,7 +104,9 @@ func TestACP_CreateWithoutIdentityAndDeleteWithoutIdentity_CanDelete(t *testing. } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -199,7 +201,9 @@ func TestACP_CreateWithoutIdentityAndDeleteWithIdentity_CanDelete(t *testing.T) } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -294,7 +298,9 @@ func TestACP_CreateWithIdentityAndDeleteWithIdentity_CanDelete(t *testing.T) { } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -389,11 +395,13 @@ func TestACP_CreateWithIdentityAndDeleteWithoutIdentity_CanNotDelete(t *testing. } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -492,11 +500,13 @@ func TestACP_CreateWithIdentityAndDeleteWithWrongIdentity_CanNotDelete(t *testin } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, diff --git a/tests/integration/acp/register_and_read_test.go b/tests/integration/acp/register_and_read_test.go index dabf356e3c..83d0819f54 100644 --- a/tests/integration/acp/register_and_read_test.go +++ b/tests/integration/acp/register_and_read_test.go @@ -93,11 +93,13 @@ func TestACP_CreateWithoutIdentityAndReadWithoutIdentity_CanRead(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -184,11 +186,13 @@ func TestACP_CreateWithoutIdentityAndReadWithIdentity_CanRead(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -277,11 +281,13 @@ func TestACP_CreateWithIdentityAndReadWithIdentity_CanRead(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -368,7 +374,9 @@ func TestACP_CreateWithIdentityAndReadWithoutIdentity_CanNotRead(t *testing.T) { } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -455,7 +463,9 @@ func TestACP_CreateWithIdentityAndReadWithWrongIdentity_CanNotRead(t *testing.T) } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/acp/register_and_update_test.go b/tests/integration/acp/register_and_update_test.go index 842ef1b754..4bf39a0508 100644 --- a/tests/integration/acp/register_and_update_test.go +++ b/tests/integration/acp/register_and_update_test.go @@ -110,11 +110,13 @@ func TestACP_CreateWithoutIdentityAndUpdateWithoutIdentity_CanUpdate(t *testing. } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad Lone", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad Lone", + "age": int64(28), + }, }, }, }, @@ -217,11 +219,13 @@ func TestACP_CreateWithoutIdentityAndUpdateWithIdentity_CanUpdate(t *testing.T) } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad Lone", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad Lone", + "age": int64(28), + }, }, }, }, @@ -324,11 +328,13 @@ func TestACP_CreateWithIdentityAndUpdateWithIdentity_CanUpdate(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad Lone", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad Lone", + "age": int64(28), + }, }, }, }, @@ -437,11 +443,13 @@ func TestACP_CreateWithIdentityAndUpdateWithoutIdentity_CanNotUpdate(t *testing. } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -552,11 +560,13 @@ func TestACP_CreateWithIdentityAndUpdateWithWrongIdentity_CanNotUpdate(t *testin } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -666,11 +676,13 @@ func TestACP_CreateWithIdentityAndUpdateWithoutIdentityGQL_CanNotUpdate(t *testi } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, @@ -782,11 +794,13 @@ func TestACP_CreateWithIdentityAndUpdateWithWrongIdentityGQL_CanNotUpdate(t *tes } } `, - Results: []map[string]any{ - { - "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", - "name": "Shahzad", - "age": int64(28), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", + "name": "Shahzad", + "age": int64(28), + }, }, }, }, diff --git a/tests/integration/backup/one_to_many/import_test.go b/tests/integration/backup/one_to_many/import_test.go index 70260d58d8..2a48fb878f 100644 --- a/tests/integration/backup/one_to_many/import_test.go +++ b/tests/integration/backup/one_to_many/import_test.go @@ -40,18 +40,20 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(30), - }, - { - "name": "Bob", - "age": int64(32), - }, - { - "name": "Smith", - "age": int64(31), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(30), + }, + { + "name": "Bob", + "age": int64(32), + }, + { + "name": "Smith", + "age": int64(31), + }, }, }, }, @@ -62,12 +64,14 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing name } }`, - Results: []map[string]any{ - { - "name": "Game of chains", - }, - { - "name": "John and the sourcerers' stone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Game of chains", + }, + { + "name": "John and the sourcerers' stone", + }, }, }, }, @@ -120,14 +124,16 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(31), - }, - { - "name": "Bob", - "age": int64(31), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(31), + }, + { + "name": "Bob", + "age": int64(31), + }, }, }, }, @@ -141,17 +147,19 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr } } }`, - Results: []map[string]any{ - { - "name": "Game of chains", - "author": map[string]any{ - "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Game of chains", + "author": map[string]any{ + "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", + }, }, - }, - { - "name": "John and the sourcerers' stone", - "author": map[string]any{ - "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", + { + "name": "John and the sourcerers' stone", + "author": map[string]any{ + "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", + }, }, }, }, diff --git a/tests/integration/backup/one_to_one/import_test.go b/tests/integration/backup/one_to_one/import_test.go index 4451841163..15bdad354b 100644 --- a/tests/integration/backup/one_to_one/import_test.go +++ b/tests/integration/backup/one_to_one/import_test.go @@ -40,18 +40,20 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(30), - }, - { - "name": "Bob", - "age": int64(32), - }, - { - "name": "Smith", - "age": int64(31), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(30), + }, + { + "name": "Bob", + "age": int64(32), + }, + { + "name": "Smith", + "age": int64(31), + }, }, }, }, @@ -62,12 +64,14 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing name } }`, - Results: []map[string]any{ - { - "name": "Game of chains", - }, - { - "name": "John and the sourcerers' stone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Game of chains", + }, + { + "name": "John and the sourcerers' stone", + }, }, }, }, @@ -114,14 +118,16 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(31), - }, - { - "name": "Bob", - "age": int64(31), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(31), + }, + { + "name": "Bob", + "age": int64(31), + }, }, }, }, @@ -135,11 +141,13 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr } } }`, - Results: []map[string]any{ - { - "name": "John and the sourcerers' stone", - "author": map[string]any{ - "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "John and the sourcerers' stone", + "author": map[string]any{ + "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", + }, }, }, }, @@ -226,19 +234,21 @@ func TestBackupImport_DoubleRelationshipWithUpdate_NoError(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John and the sourcerers' stone", - "author": map[string]any{ - "name": "John", - "favouriteBook": map[string]any{ - "name": "John and the sourcerers' stone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "John and the sourcerers' stone", + "author": map[string]any{ + "name": "John", + "favouriteBook": map[string]any{ + "name": "John and the sourcerers' stone", + }, }, }, - }, - { - "name": "Game of chains", - "author": nil, + { + "name": "Game of chains", + "author": nil, + }, }, }, }, diff --git a/tests/integration/backup/self_reference/import_test.go b/tests/integration/backup/self_reference/import_test.go index 5ddb800a41..1d0b39d2e7 100644 --- a/tests/integration/backup/self_reference/import_test.go +++ b/tests/integration/backup/self_reference/import_test.go @@ -48,15 +48,17 @@ func TestBackupSelfRefImport_Simple_NoError(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John", - "boss": nil, - }, - { - "name": "Bob", - "boss": map[string]any{ + Results: map[string]any{ + "User": []map[string]any{ + { "name": "John", + "boss": nil, + }, + { + "name": "Bob", + "boss": map[string]any{ + "name": "John", + }, }, }, }, @@ -120,11 +122,13 @@ func TestBackupSelfRefImport_SelfRef_NoError(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Bob", - "boss": map[string]any{ + Results: map[string]any{ + "User": []map[string]any{ + { "name": "Bob", + "boss": map[string]any{ + "name": "Bob", + }, }, }, }, @@ -181,13 +185,15 @@ func TestBackupSelfRefImport_PrimaryRelationWithSecondCollection_NoError(t *test } } }`, - Results: []map[string]any{ - { - "name": "John and the sourcerers' stone", - "author": map[string]any{ - "name": "John", - "reviewed": map[string]any{ - "name": "John and the sourcerers' stone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "John and the sourcerers' stone", + "author": map[string]any{ + "name": "John", + "reviewed": map[string]any{ + "name": "John and the sourcerers' stone", + }, }, }, }, @@ -245,13 +251,15 @@ func TestBackupSelfRefImport_PrimaryRelationWithSecondCollectionWrongOrder_NoErr } } }`, - Results: []map[string]any{ - { - "name": "John and the sourcerers' stone", - "author": map[string]any{ - "name": "John", - "reviewed": map[string]any{ - "name": "John and the sourcerers' stone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "John and the sourcerers' stone", + "author": map[string]any{ + "name": "John", + "reviewed": map[string]any{ + "name": "John and the sourcerers' stone", + }, }, }, }, @@ -355,12 +363,14 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t } } }`, - Results: []map[string]any{ - { - "name": "John and the sourcerers' stone", - "author": map[string]any{ - "name": "John", - "reviewed": nil, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "John and the sourcerers' stone", + "author": map[string]any{ + "name": "John", + "reviewed": nil, + }, }, }, }, diff --git a/tests/integration/backup/simple/import_test.go b/tests/integration/backup/simple/import_test.go index 5d8d4a6ccc..0565a76c3f 100644 --- a/tests/integration/backup/simple/import_test.go +++ b/tests/integration/backup/simple/import_test.go @@ -30,10 +30,12 @@ func TestBackupImport_Simple_NoError(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(30), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(30), + }, }, }, }, @@ -100,10 +102,12 @@ func TestBackupImport_WithNoKeys_NoError(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(30), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(30), + }, }, }, }, @@ -131,18 +135,20 @@ func TestBackupImport_WithMultipleNoKeys_NoError(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(30), - }, - { - "name": "Bob", - "age": int64(32), - }, - { - "name": "Smith", - "age": int64(31), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(30), + }, + { + "name": "Bob", + "age": int64(32), + }, + { + "name": "Smith", + "age": int64(31), + }, }, }, }, @@ -165,9 +171,11 @@ func TestBackupImport_EmptyObject_NoError(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": nil, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": nil, + }, }, }, }, @@ -197,7 +205,9 @@ func TestBackupImport_WithMultipleNoKeysAndInvalidField_Errors(t *testing.T) { } }`, // No documents should have been commited - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/collection/update/simple/with_filter_test.go b/tests/integration/collection/update/simple/with_filter_test.go index a99f340753..9be676476f 100644 --- a/tests/integration/collection/update/simple/with_filter_test.go +++ b/tests/integration/collection/update/simple/with_filter_test.go @@ -117,8 +117,10 @@ func TestUpdateWithPatch_DoesNothing(t *testing.T) { name } }`, - Results: []map[string]any{ - {"name": "John"}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "John"}, + }, }, }, }, @@ -149,8 +151,10 @@ func TestUpdateWithFilter_Succeeds(t *testing.T) { name } }`, - Results: []map[string]any{ - {"name": "Eric"}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "Eric"}, + }, }, }, }, diff --git a/tests/integration/collection_description/updates/copy/name_test.go b/tests/integration/collection_description/updates/copy/name_test.go index f5cbd3a83b..2af643361d 100644 --- a/tests/integration/collection_description/updates/copy/name_test.go +++ b/tests/integration/collection_description/updates/copy/name_test.go @@ -85,9 +85,11 @@ func TestColDescrUpdateCopyName(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/collection_description/updates/move/name_test.go b/tests/integration/collection_description/updates/move/name_test.go index f493b03c1a..f1e16f02c5 100644 --- a/tests/integration/collection_description/updates/move/name_test.go +++ b/tests/integration/collection_description/updates/move/name_test.go @@ -53,9 +53,11 @@ func TestColDescrUpdateMoveName(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/collection_description/updates/remove/col_source_transform_test.go b/tests/integration/collection_description/updates/remove/col_source_transform_test.go index 73179c16b0..253063c45f 100644 --- a/tests/integration/collection_description/updates/remove/col_source_transform_test.go +++ b/tests/integration/collection_description/updates/remove/col_source_transform_test.go @@ -67,9 +67,11 @@ func TestColDescrUpdateRemoveCollectionSourceTransform(t *testing.T) { } }`, // If the transform was not removed, `"Fred"` would have been returned - Results: []map[string]any{ - { - "name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + }, }, }, }, diff --git a/tests/integration/collection_description/updates/replace/col_source_transform_test.go b/tests/integration/collection_description/updates/replace/col_source_transform_test.go index b933dcd2ed..93db3e9ab1 100644 --- a/tests/integration/collection_description/updates/replace/col_source_transform_test.go +++ b/tests/integration/collection_description/updates/replace/col_source_transform_test.go @@ -75,9 +75,11 @@ func TestColDescrUpdateReplaceCollectionSourceTransform(t *testing.T) { } }`, // Without the new transform, `"Shahzad"` would have been returned - Results: []map[string]any{ - { - "name": "Fred", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + }, }, }, }, diff --git a/tests/integration/collection_description/updates/replace/name_test.go b/tests/integration/collection_description/updates/replace/name_test.go index 55e8160969..e2fe9886d1 100644 --- a/tests/integration/collection_description/updates/replace/name_test.go +++ b/tests/integration/collection_description/updates/replace/name_test.go @@ -63,9 +63,11 @@ func TestColDescrUpdateReplaceName_GivenExistingName(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Actors": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -197,9 +199,11 @@ func TestColDescrUpdateReplaceName_RemoveExistingName(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Actors": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/collection_description/updates/replace/query_source_query_test.go b/tests/integration/collection_description/updates/replace/query_source_query_test.go index 789f4b2d7b..1891923b46 100644 --- a/tests/integration/collection_description/updates/replace/query_source_query_test.go +++ b/tests/integration/collection_description/updates/replace/query_source_query_test.go @@ -66,9 +66,11 @@ func TestColDescrUpdateReplaceQuerySourceQuery(t *testing.T) { } }`, // If the view was still querying `Books` there would be no results - Results: []map[string]any{ - { - "name": "Shahzad", + Results: map[string]any{ + "View": []map[string]any{ + { + "name": "Shahzad", + }, }, }, }, @@ -128,9 +130,11 @@ func TestColDescrUpdateReplaceQuerySourceQueryName(t *testing.T) { } }`, // If the view was still querying `Books` there would be no results - Results: []map[string]any{ - { - "name": "Shahzad", + Results: map[string]any{ + "View": []map[string]any{ + { + "name": "Shahzad", + }, }, }, }, diff --git a/tests/integration/collection_description/updates/replace/query_source_transform_test.go b/tests/integration/collection_description/updates/replace/query_source_transform_test.go index 89a2598010..a66e3bc3b5 100644 --- a/tests/integration/collection_description/updates/replace/query_source_transform_test.go +++ b/tests/integration/collection_description/updates/replace/query_source_transform_test.go @@ -100,9 +100,11 @@ func TestColDescrUpdateReplaceQuerySourceTransform(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fullName": "S", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "fullName": "S", + }, }, }, }, diff --git a/tests/integration/encryption/commit_relation_test.go b/tests/integration/encryption/commit_relation_test.go index 848afa5fd3..7097c0fb56 100644 --- a/tests/integration/encryption/commit_relation_test.go +++ b/tests/integration/encryption/commit_relation_test.go @@ -62,36 +62,38 @@ func TestDocEncryption_WithEncryptionSecondaryRelations_ShouldStoreEncryptedComm } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue("Chris"), userDocID, ""), - "docID": userDocID, - "fieldName": "name", - }, - { - "delta": nil, - "docID": userDocID, - "fieldName": nil, - }, - { - "delta": encrypt(testUtils.CBORValue("Sony"), deviceDocID, ""), - "docID": deviceDocID, - "fieldName": "manufacturer", - }, - { - "delta": encrypt(testUtils.CBORValue("Walkman"), deviceDocID, ""), - "docID": deviceDocID, - "fieldName": "model", - }, - { - "delta": encrypt(testUtils.CBORValue(userDocID), deviceDocID, ""), - "docID": deviceDocID, - "fieldName": "owner_id", - }, - { - "delta": nil, - "docID": deviceDocID, - "fieldName": nil, + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue("Chris"), userDocID, ""), + "docID": userDocID, + "fieldName": "name", + }, + { + "delta": nil, + "docID": userDocID, + "fieldName": nil, + }, + { + "delta": encrypt(testUtils.CBORValue("Sony"), deviceDocID, ""), + "docID": deviceDocID, + "fieldName": "manufacturer", + }, + { + "delta": encrypt(testUtils.CBORValue("Walkman"), deviceDocID, ""), + "docID": deviceDocID, + "fieldName": "model", + }, + { + "delta": encrypt(testUtils.CBORValue(userDocID), deviceDocID, ""), + "docID": deviceDocID, + "fieldName": "owner_id", + }, + { + "delta": nil, + "docID": deviceDocID, + "fieldName": nil, + }, }, }, }, diff --git a/tests/integration/encryption/commit_test.go b/tests/integration/encryption/commit_test.go index ffa5333748..86ea5d88df 100644 --- a/tests/integration/encryption/commit_test.go +++ b/tests/integration/encryption/commit_test.go @@ -45,43 +45,45 @@ func TestDocEncryption_WithEncryptionOnLWWCRDT_ShouldStoreCommitsDeltaEncrypted( } } `, - Results: []map[string]any{ - { - "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", - "collectionID": int64(1), - "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), - "docID": john21DocID, - "fieldId": "1", - "fieldName": "age", - "height": int64(1), - "links": []map[string]any{}, - }, - { - "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", - "collectionID": int64(1), - "delta": encrypt(testUtils.CBORValue("John"), john21DocID, ""), - "docID": john21DocID, - "fieldId": "2", - "fieldName": "name", - "height": int64(1), - "links": []map[string]any{}, - }, - { - "cid": "bafyreidxdhzhwjrv5s4x6cho5drz6xq2tc7oymzupf4p4gfk6eelsnc7ke", - "collectionID": int64(1), - "delta": nil, - "docID": john21DocID, - "fieldId": "C", - "fieldName": nil, - "height": int64(1), - "links": []map[string]any{ - { - "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", - "name": "age", - }, - { - "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", - "name": "name", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", + "collectionID": int64(1), + "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), + "docID": john21DocID, + "fieldId": "1", + "fieldName": "age", + "height": int64(1), + "links": []map[string]any{}, + }, + { + "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", + "collectionID": int64(1), + "delta": encrypt(testUtils.CBORValue("John"), john21DocID, ""), + "docID": john21DocID, + "fieldId": "2", + "fieldName": "name", + "height": int64(1), + "links": []map[string]any{}, + }, + { + "cid": "bafyreidxdhzhwjrv5s4x6cho5drz6xq2tc7oymzupf4p4gfk6eelsnc7ke", + "collectionID": int64(1), + "delta": nil, + "docID": john21DocID, + "fieldId": "C", + "fieldName": nil, + "height": int64(1), + "links": []map[string]any{ + { + "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", + "name": "age", + }, + { + "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", + "name": "name", + }, }, }, }, @@ -114,12 +116,14 @@ func TestDocEncryption_UponUpdateOnLWWCRDT_ShouldEncryptCommitDelta(t *testing.T } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue(22), john21DocID, ""), - }, - { - "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue(22), john21DocID, ""), + }, + { + "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), + }, }, }, }, @@ -161,22 +165,24 @@ func TestDocEncryption_WithMultipleDocsUponUpdate_ShouldEncryptOnlyRelevantDocs( } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue(22), john21DocID, ""), - "docID": john21DocID, - }, - { - "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), - "docID": john21DocID, - }, - { - "delta": testUtils.CBORValue(34), - "docID": islam33DocID, - }, - { - "delta": testUtils.CBORValue(33), - "docID": islam33DocID, + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue(22), john21DocID, ""), + "docID": john21DocID, + }, + { + "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), + "docID": john21DocID, + }, + { + "delta": testUtils.CBORValue(34), + "docID": islam33DocID, + }, + { + "delta": testUtils.CBORValue(33), + "docID": islam33DocID, + }, }, }, }, @@ -210,14 +216,16 @@ func TestDocEncryption_WithEncryptionOnCounterCRDT_ShouldStoreCommitsDeltaEncryp } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue(5), docID, ""), - "docID": docID, - }, - { - "delta": nil, - "docID": docID, + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue(5), docID, ""), + "docID": docID, + }, + { + "delta": nil, + "docID": docID, + }, }, }, }, @@ -255,12 +263,14 @@ func TestDocEncryption_UponUpdateOnCounterCRDT_ShouldEncryptedCommitDelta(t *tes } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue(3), docID, ""), - }, - { - "delta": encrypt(testUtils.CBORValue(5), docID, ""), + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue(3), docID, ""), + }, + { + "delta": encrypt(testUtils.CBORValue(5), docID, ""), + }, }, }, }, @@ -287,30 +297,32 @@ func TestDocEncryption_UponEncryptionSeveralDocs_ShouldStoreAllCommitsDeltaEncry } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), - "docID": testUtils.NewDocIndex(0, 0), - }, - { - "delta": encrypt(testUtils.CBORValue("John"), john21DocID, ""), - "docID": testUtils.NewDocIndex(0, 0), - }, - { - "delta": nil, - "docID": testUtils.NewDocIndex(0, 0), - }, - { - "delta": encrypt(testUtils.CBORValue(33), islam33DocID, ""), - "docID": testUtils.NewDocIndex(0, 1), - }, - { - "delta": encrypt(testUtils.CBORValue("Islam"), islam33DocID, ""), - "docID": testUtils.NewDocIndex(0, 1), - }, - { - "delta": nil, - "docID": testUtils.NewDocIndex(0, 1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), + "docID": testUtils.NewDocIndex(0, 0), + }, + { + "delta": encrypt(testUtils.CBORValue("John"), john21DocID, ""), + "docID": testUtils.NewDocIndex(0, 0), + }, + { + "delta": nil, + "docID": testUtils.NewDocIndex(0, 0), + }, + { + "delta": encrypt(testUtils.CBORValue(33), islam33DocID, ""), + "docID": testUtils.NewDocIndex(0, 1), + }, + { + "delta": encrypt(testUtils.CBORValue("Islam"), islam33DocID, ""), + "docID": testUtils.NewDocIndex(0, 1), + }, + { + "delta": nil, + "docID": testUtils.NewDocIndex(0, 1), + }, }, }, }, @@ -347,11 +359,12 @@ func TestDocEncryption_IfTwoDocsHaveSameFieldValue_CipherTextShouldBeDifferent(t } } `, - Asserter: testUtils.ResultAsserterFunc(func(_ testing.TB, result []map[string]any) (bool, string) { - require.Equal(t, 2, len(result), "Expected 2 commits") - require.Equal(t, result[0]["fieldName"], "age") - delta1 := result[0]["delta"] - delta2 := result[1]["delta"] + Asserter: testUtils.ResultAsserterFunc(func(t testing.TB, result map[string]any) (bool, string) { + commits := testUtils.ConvertToArrayOfMaps(t, result["commits"]) + require.Equal(t, 2, len(commits), "Expected 2 commits") + require.Equal(t, commits[0]["fieldName"], "age") + delta1 := commits[0]["delta"] + delta2 := commits[1]["delta"] assert.NotEqual(t, delta1, delta2, "docs should be encrypted with different encryption keys") return true, "" }), diff --git a/tests/integration/encryption/field_commit_test.go b/tests/integration/encryption/field_commit_test.go index 5a956a42b2..e1531bca1c 100644 --- a/tests/integration/encryption/field_commit_test.go +++ b/tests/integration/encryption/field_commit_test.go @@ -36,21 +36,23 @@ func TestDocEncryptionField_WithEncryptionOnField_ShouldStoreOnlyFieldsDeltaEncr } } `, - Results: []map[string]any{ - { - "delta": encrypt(testUtils.CBORValue(21), john21DocID, "age"), - "docID": john21DocID, - "fieldName": "age", - }, - { - "delta": testUtils.CBORValue("John"), - "docID": john21DocID, - "fieldName": "name", - }, - { - "delta": nil, - "docID": john21DocID, - "fieldName": nil, + Results: map[string]any{ + "commits": []map[string]any{ + { + "delta": encrypt(testUtils.CBORValue(21), john21DocID, "age"), + "docID": john21DocID, + "fieldName": "age", + }, + { + "delta": testUtils.CBORValue("John"), + "docID": john21DocID, + "fieldName": "name", + }, + { + "delta": nil, + "docID": john21DocID, + "fieldName": nil, + }, }, }, }, @@ -102,11 +104,12 @@ func TestDocEncryptionField_WithDocAndFieldEncryption_ShouldUseDedicatedEncKeyFo } } `, - Asserter: testUtils.ResultAsserterFunc(func(_ testing.TB, result []map[string]any) (bool, string) { - name1 := deltaForField("name1", result) - name2 := deltaForField("name2", result) - name3 := deltaForField("name3", result) - name4 := deltaForField("name4", result) + Asserter: testUtils.ResultAsserterFunc(func(t testing.TB, result map[string]any) (bool, string) { + commits := testUtils.ConvertToArrayOfMaps(t, result["commits"]) + name1 := deltaForField("name1", commits) + name2 := deltaForField("name2", commits) + name3 := deltaForField("name3", commits) + name4 := deltaForField("name4", commits) assert.Equal(t, name2, name4, "name2 and name4 should have the same encryption key") assert.NotEqual(t, name2, name1, "name2 and name1 should have different encryption keys") assert.NotEqual(t, name2, name3, "name2 and name3 should have different encryption keys") @@ -171,11 +174,12 @@ func TestDocEncryptionField_UponUpdateWithDocAndFieldEncryption_ShouldUseDedicat } } `, - Asserter: testUtils.ResultAsserterFunc(func(_ testing.TB, result []map[string]any) (bool, string) { - name1 := deltaForField("name1", result) - name2 := deltaForField("name2", result) - name3 := deltaForField("name3", result) - name4 := deltaForField("name4", result) + Asserter: testUtils.ResultAsserterFunc(func(_ testing.TB, result map[string]any) (bool, string) { + commits := testUtils.ConvertToArrayOfMaps(t, result["commits"]) + name1 := deltaForField("name1", commits) + name2 := deltaForField("name2", commits) + name3 := deltaForField("name3", commits) + name4 := deltaForField("name4", commits) assert.Equal(t, name2, name4, "name2 and name4 should have the same encryption key") assert.NotEqual(t, name2, name1, "name2 and name1 should have different encryption keys") assert.NotEqual(t, name2, name3, "name2 and name3 should have different encryption keys") diff --git a/tests/integration/encryption/field_query_test.go b/tests/integration/encryption/field_query_test.go index d008960448..acf4ada937 100644 --- a/tests/integration/encryption/field_query_test.go +++ b/tests/integration/encryption/field_query_test.go @@ -39,11 +39,13 @@ func TestDocEncryptionField_WithEncryption_ShouldFetchDecrypted(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "_docID": testUtils.NewDocIndex(0, 0), - "name": "John", - "age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(0, 0), + "name": "John", + "age": int64(21), + }, }, }, }, diff --git a/tests/integration/encryption/peer_test.go b/tests/integration/encryption/peer_test.go index 4eb0ddc19a..7a94c22e13 100644 --- a/tests/integration/encryption/peer_test.go +++ b/tests/integration/encryption/peer_test.go @@ -45,7 +45,9 @@ func TestDocEncryptionPeer_IfPeerHasNoKey_ShouldNotFetch(t *testing.T) { age } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -92,43 +94,45 @@ func TestDocEncryptionPeer_UponSync_ShouldSyncEncryptedDAG(t *testing.T) { } } `, - Results: []map[string]any{ - { - "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", - "collectionID": int64(1), - "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), - "docID": john21DocID, - "fieldId": "1", - "fieldName": "age", - "height": int64(1), - "links": []map[string]any{}, - }, - { - "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", - "collectionID": int64(1), - "delta": encrypt(testUtils.CBORValue("John"), john21DocID, ""), - "docID": john21DocID, - "fieldId": "2", - "fieldName": "name", - "height": int64(1), - "links": []map[string]any{}, - }, - { - "cid": "bafyreidxdhzhwjrv5s4x6cho5drz6xq2tc7oymzupf4p4gfk6eelsnc7ke", - "collectionID": int64(1), - "delta": nil, - "docID": john21DocID, - "fieldId": "C", - "fieldName": nil, - "height": int64(1), - "links": []map[string]any{ - { - "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", - "name": "age", - }, - { - "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", - "name": "name", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", + "collectionID": int64(1), + "delta": encrypt(testUtils.CBORValue(21), john21DocID, ""), + "docID": john21DocID, + "fieldId": "1", + "fieldName": "age", + "height": int64(1), + "links": []map[string]any{}, + }, + { + "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", + "collectionID": int64(1), + "delta": encrypt(testUtils.CBORValue("John"), john21DocID, ""), + "docID": john21DocID, + "fieldId": "2", + "fieldName": "name", + "height": int64(1), + "links": []map[string]any{}, + }, + { + "cid": "bafyreidxdhzhwjrv5s4x6cho5drz6xq2tc7oymzupf4p4gfk6eelsnc7ke", + "collectionID": int64(1), + "delta": nil, + "docID": john21DocID, + "fieldId": "C", + "fieldName": nil, + "height": int64(1), + "links": []map[string]any{ + { + "cid": "bafyreibdjepzhhiez4o27srv33xcd52yr336tpzqtkv36rdf3h3oue2l5m", + "name": "age", + }, + { + "cid": "bafyreihkiua7jpwkye3xlex6s5hh2azckcaljfi2h3iscgub5sikacyrbu", + "name": "name", + }, }, }, }, diff --git a/tests/integration/encryption/query_relation_test.go b/tests/integration/encryption/query_relation_test.go index 8ca51c03aa..fb9a0b0730 100644 --- a/tests/integration/encryption/query_relation_test.go +++ b/tests/integration/encryption/query_relation_test.go @@ -59,13 +59,15 @@ func TestDocEncryption_WithEncryptionOnBothRelations_ShouldFetchDecrypted(t *tes } } }`, - Results: []map[string]any{ - { - "name": "Chris", - "devices": []map[string]any{ - { - "model": "Walkman", - "manufacturer": "Sony", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Chris", + "devices": []map[string]any{ + { + "model": "Walkman", + "manufacturer": "Sony", + }, }, }, }, @@ -119,13 +121,15 @@ func TestDocEncryption_WithEncryptionOnPrimaryRelations_ShouldFetchDecrypted(t * } } }`, - Results: []map[string]any{ - { - "name": "Chris", - "devices": []map[string]any{ - { - "model": "Walkman", - "manufacturer": "Sony", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Chris", + "devices": []map[string]any{ + { + "model": "Walkman", + "manufacturer": "Sony", + }, }, }, }, @@ -179,13 +183,15 @@ func TestDocEncryption_WithEncryptionOnSecondaryRelations_ShouldFetchDecrypted(t } } }`, - Results: []map[string]any{ - { - "name": "Chris", - "devices": []map[string]any{ - { - "model": "Walkman", - "manufacturer": "Sony", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Chris", + "devices": []map[string]any{ + { + "model": "Walkman", + "manufacturer": "Sony", + }, }, }, }, diff --git a/tests/integration/encryption/query_test.go b/tests/integration/encryption/query_test.go index 05e7b1dcdd..a949081120 100644 --- a/tests/integration/encryption/query_test.go +++ b/tests/integration/encryption/query_test.go @@ -39,11 +39,13 @@ func TestDocEncryption_WithEncryption_ShouldFetchDecrypted(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "_docID": testUtils.NewDocIndex(0, 0), - "name": "John", - "age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(0, 0), + "name": "John", + "age": int64(21), + }, }, }, }, @@ -80,10 +82,12 @@ func TestDocEncryption_WithEncryptionOnCounterCRDT_ShouldFetchDecrypted(t *testi }, testUtils.Request{ Request: query, - Results: []map[string]any{ - { - "name": "John", - "points": 5, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": 5, + }, }, }, }, @@ -93,10 +97,12 @@ func TestDocEncryption_WithEncryptionOnCounterCRDT_ShouldFetchDecrypted(t *testi }, testUtils.Request{ Request: query, - Results: []map[string]any{ - { - "name": "John", - "points": 8, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": 8, + }, }, }, }, diff --git a/tests/integration/explain.go b/tests/integration/explain.go index fafab87134..7bc7f9074a 100644 --- a/tests/integration/explain.go +++ b/tests/integration/explain.go @@ -57,6 +57,7 @@ var ( "valuesNode": {}, "viewNode": {}, "lensNode": {}, + "operationNode": {}, } ) @@ -86,12 +87,12 @@ type ExplainRequest struct { // The raw expected explain graph with everything (helpful for debugging purposes). // Note: This is not always asserted (i.e. ignored from the comparison if not provided). - ExpectedFullGraph []map[string]any + ExpectedFullGraph map[string]any // Pattern is used to assert that the plan nodes are in the correct order (attributes are omitted). // Note: - Explain requests of type 'debug' will only have Pattern (as they don't have attributes). // - This is not always asserted (i.e. ignored from the comparison if not provided). - ExpectedPatterns []map[string]any + ExpectedPatterns map[string]any // Every target helps assert an individual node somewhere in the explain graph (node's position is omitted). // Each target assertion is only responsible to check if the node's attributes are correct. @@ -156,42 +157,33 @@ func assertExplainRequestResults( } // Note: if returned gql result is `nil` this panics (the panic seems useful while testing). - resultantData := actualResult.Data.([]map[string]any) + resultantData := actualResult.Data.(map[string]any) log.InfoContext(s.ctx, "", corelog.Any("FullExplainGraphResult", actualResult.Data)) // Check if the expected full explain graph (if provided) matches the actual full explain graph // that is returned, if doesn't match we would like to still see a diff comparison (handy while debugging). - if lengthOfExpectedFullGraph := len(action.ExpectedFullGraph); action.ExpectedFullGraph != nil { - require.Equal(s.t, lengthOfExpectedFullGraph, len(resultantData), s.testCase.Description) - for index, actualResult := range resultantData { - if lengthOfExpectedFullGraph > index { - assertResultsEqual( - s.t, - s.clientType, - action.ExpectedFullGraph[index], - actualResult, - s.testCase.Description, - ) - } - } + if action.ExpectedFullGraph != nil { + assertResultsEqual( + s.t, + s.clientType, + action.ExpectedFullGraph, + resultantData, + s.testCase.Description, + ) } // Ensure the complete high-level pattern matches, inother words check that all the // explain graph nodes are in the correct expected ordering. if action.ExpectedPatterns != nil { - require.Equal(s.t, len(action.ExpectedPatterns), len(resultantData), s.testCase.Description) - - for index, actualResult := range resultantData { - // Trim away all attributes (non-plan nodes) from the returned full explain graph result. - actualResultWithoutAttributes := trimExplainAttributes(s.t, s.testCase.Description, actualResult) - assertResultsEqual( - s.t, - s.clientType, - action.ExpectedPatterns[index], - actualResultWithoutAttributes, - s.testCase.Description, - ) - } + // Trim away all attributes (non-plan nodes) from the returned full explain graph result. + actualResultWithoutAttributes := trimExplainAttributes(s.t, s.testCase.Description, resultantData) + assertResultsEqual( + s.t, + s.clientType, + action.ExpectedPatterns, + actualResultWithoutAttributes, + s.testCase.Description, + ) } // Match the targeted node's attributes (subset assertions), with the expected attributes. @@ -206,7 +198,7 @@ func assertExplainRequestResults( func assertExplainTargetCase( s *state, targetCase PlanNodeTargetCase, - actualResults []map[string]any, + actualResults map[string]any, ) { for _, actualResult := range actualResults { foundActualTarget, _, isFound := findTargetNode( diff --git a/tests/integration/explain/debug/basic_test.go b/tests/integration/explain/debug/basic_test.go index f97305d091..68be571469 100644 --- a/tests/integration/explain/debug/basic_test.go +++ b/tests/integration/explain/debug/basic_test.go @@ -32,7 +32,7 @@ func TestDebugExplainRequest(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{basicPattern}, + ExpectedFullGraph: basicPattern, }, }, } diff --git a/tests/integration/explain/debug/create_test.go b/tests/integration/explain/debug/create_test.go index 21d334bb84..dc43fc5365 100644 --- a/tests/integration/explain/debug/create_test.go +++ b/tests/integration/explain/debug/create_test.go @@ -19,10 +19,14 @@ import ( var createPattern = dataMap{ "explain": dataMap{ - "createNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "createNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDebugExplainMutationRequestWithCreate(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{createPattern}, + ExpectedPatterns: createPattern, }, }, } @@ -69,7 +73,7 @@ func TestDebugExplainMutationRequestDoesNotCreateDocGivenDuplicate(t *testing.T) } }`, - ExpectedPatterns: []dataMap{createPattern}, + ExpectedPatterns: createPattern, }, }, } diff --git a/tests/integration/explain/debug/dagscan_test.go b/tests/integration/explain/debug/dagscan_test.go index 8da73b747f..868b048915 100644 --- a/tests/integration/explain/debug/dagscan_test.go +++ b/tests/integration/explain/debug/dagscan_test.go @@ -19,9 +19,13 @@ import ( var dagScanPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "dagScanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "dagScanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDebugExplainCommitsDagScanQueryOp(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{dagScanPattern}, + ExpectedFullGraph: dagScanPattern, }, }, } @@ -71,7 +75,7 @@ func TestDebugExplainCommitsDagScanQueryOpWithoutField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{dagScanPattern}, + ExpectedFullGraph: dagScanPattern, }, }, } @@ -98,7 +102,7 @@ func TestDebugExplainLatestCommitsDagScanQueryOp(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{dagScanPattern}, + ExpectedFullGraph: dagScanPattern, }, }, } @@ -125,7 +129,7 @@ func TestDebugExplainLatestCommitsDagScanQueryOpWithoutField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{dagScanPattern}, + ExpectedFullGraph: dagScanPattern, }, }, } diff --git a/tests/integration/explain/debug/delete_test.go b/tests/integration/explain/debug/delete_test.go index 88159152e0..7162b1b428 100644 --- a/tests/integration/explain/debug/delete_test.go +++ b/tests/integration/explain/debug/delete_test.go @@ -19,10 +19,14 @@ import ( var deletePattern = dataMap{ "explain": dataMap{ - "deleteNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "deleteNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDebugExplainMutationRequestWithDeleteUsingFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, }, }, } @@ -69,7 +73,7 @@ func TestDebugExplainMutationRequestWithDeleteUsingFilterToMatchEverything(t *te } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, }, }, } @@ -93,7 +97,7 @@ func TestDebugExplainMutationRequestWithDeleteUsingId(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, }, }, } @@ -120,7 +124,7 @@ func TestDebugExplainMutationRequestWithDeleteUsingIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, }, }, } @@ -144,7 +148,7 @@ func TestDebugExplainMutationRequestWithDeleteUsingNoIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, }, }, } @@ -176,7 +180,7 @@ func TestDebugExplainMutationRequestWithDeleteUsingFilterAndIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, }, }, } diff --git a/tests/integration/explain/debug/fixture.go b/tests/integration/explain/debug/fixture.go index f77c0a3839..5a149eed36 100644 --- a/tests/integration/explain/debug/fixture.go +++ b/tests/integration/explain/debug/fixture.go @@ -14,9 +14,13 @@ type dataMap = map[string]any var basicPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, diff --git a/tests/integration/explain/debug/group_test.go b/tests/integration/explain/debug/group_test.go index af738627b8..3300523313 100644 --- a/tests/integration/explain/debug/group_test.go +++ b/tests/integration/explain/debug/group_test.go @@ -19,11 +19,15 @@ import ( var groupPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "pipeNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "pipeNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -50,7 +54,7 @@ func TestDebugExplainRequestWithGroupByOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{groupPattern}, + ExpectedFullGraph: groupPattern, }, }, } @@ -77,7 +81,7 @@ func TestDebugExplainRequestWithGroupByTwoFieldsOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{groupPattern}, + ExpectedFullGraph: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_average_test.go b/tests/integration/explain/debug/group_with_average_test.go index e001c1a529..1586a37649 100644 --- a/tests/integration/explain/debug/group_with_average_test.go +++ b/tests/integration/explain/debug/group_with_average_test.go @@ -19,14 +19,18 @@ import ( var debugGroupAveragePattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "pipeNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "pipeNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -54,7 +58,7 @@ func TestDebugExplainRequestWithGroupByWithAverageOnAnInnerField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugGroupAveragePattern}, + ExpectedPatterns: debugGroupAveragePattern, }, }, } @@ -83,7 +87,7 @@ func TestDebugExplainRequestWithAverageInsideTheInnerGroupOnAField(t *testing.T) } }`, - ExpectedPatterns: []dataMap{debugGroupAveragePattern}, + ExpectedPatterns: debugGroupAveragePattern, }, }, } @@ -115,7 +119,7 @@ func TestDebugExplainRequestWithAverageInsideTheInnerGroupOnAFieldAndNestedGroup } }`, - ExpectedPatterns: []dataMap{debugGroupAveragePattern}, + ExpectedPatterns: debugGroupAveragePattern, }, }, } @@ -148,7 +152,7 @@ func TestDebugExplainRequestWithAverageInsideTheInnerGroupAndNestedGroupByWithAv } }`, - ExpectedPatterns: []dataMap{debugGroupAveragePattern}, + ExpectedPatterns: debugGroupAveragePattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_doc_id_child_test.go b/tests/integration/explain/debug/group_with_doc_id_child_test.go index 43301f1fac..7da680dbbc 100644 --- a/tests/integration/explain/debug/group_with_doc_id_child_test.go +++ b/tests/integration/explain/debug/group_with_doc_id_child_test.go @@ -38,7 +38,7 @@ func TestDebugExplainRequestWithDocIDsOnInnerGroupSelection(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_doc_id_test.go b/tests/integration/explain/debug/group_with_doc_id_test.go index ebbfbdb3c9..75728e77e0 100644 --- a/tests/integration/explain/debug/group_with_doc_id_test.go +++ b/tests/integration/explain/debug/group_with_doc_id_test.go @@ -39,7 +39,7 @@ func TestDebugExplainRequestWithDocIDOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } @@ -73,7 +73,7 @@ func TestDebugExplainRequestWithDocIDsAndFilterOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_filter_child_test.go b/tests/integration/explain/debug/group_with_filter_child_test.go index 61a8a72f3e..7da654f8d1 100644 --- a/tests/integration/explain/debug/group_with_filter_child_test.go +++ b/tests/integration/explain/debug/group_with_filter_child_test.go @@ -36,7 +36,7 @@ func TestDebugExplainRequestWithFilterOnInnerGroupSelection(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } @@ -66,7 +66,7 @@ func TestDebugExplainRequestWithFilterOnParentGroupByAndInnerGroupSelection(t *t } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_filter_test.go b/tests/integration/explain/debug/group_with_filter_test.go index b55d798c3a..62785a98a8 100644 --- a/tests/integration/explain/debug/group_with_filter_test.go +++ b/tests/integration/explain/debug/group_with_filter_test.go @@ -39,7 +39,7 @@ func TestDebugExplainRequestWithFilterOnGroupByParent(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_limit_child_test.go b/tests/integration/explain/debug/group_with_limit_child_test.go index 335c8866f0..f6e938350a 100644 --- a/tests/integration/explain/debug/group_with_limit_child_test.go +++ b/tests/integration/explain/debug/group_with_limit_child_test.go @@ -36,7 +36,7 @@ func TestDebugExplainRequestWithLimitAndOffsetOnInnerGroupSelection(t *testing.T } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } @@ -66,7 +66,7 @@ func TestDebugExplainRequestWithLimitAndOffsetOnMultipleInnerGroupSelections(t * } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_limit_test.go b/tests/integration/explain/debug/group_with_limit_test.go index 82c84969fc..af5b0afa37 100644 --- a/tests/integration/explain/debug/group_with_limit_test.go +++ b/tests/integration/explain/debug/group_with_limit_test.go @@ -19,12 +19,16 @@ import ( var debugGroupLimitPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "pipeNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "pipeNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -56,7 +60,7 @@ func TestDebugExplainRequestWithLimitAndOffsetOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugGroupLimitPattern}, + ExpectedPatterns: debugGroupLimitPattern, }, }, } @@ -86,7 +90,7 @@ func TestDebugExplainRequestWithLimitOnParentGroupByAndInnerGroupSelection(t *te } }`, - ExpectedPatterns: []dataMap{debugGroupLimitPattern}, + ExpectedPatterns: debugGroupLimitPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_order_child_test.go b/tests/integration/explain/debug/group_with_order_child_test.go index 19d97424dc..e2e9681dad 100644 --- a/tests/integration/explain/debug/group_with_order_child_test.go +++ b/tests/integration/explain/debug/group_with_order_child_test.go @@ -36,7 +36,7 @@ func TestDebugExplainRequestWithDescendingOrderOnInnerGroupSelection(t *testing. } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } @@ -63,7 +63,7 @@ func TestDebugExplainRequestWithAscendingOrderOnInnerGroupSelection(t *testing.T } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } @@ -96,7 +96,7 @@ func TestDebugExplainRequestWithOrderOnNestedParentGroupByAndOnNestedParentsInne } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, }, }, } diff --git a/tests/integration/explain/debug/group_with_order_test.go b/tests/integration/explain/debug/group_with_order_test.go index a7e3b717b0..9379c9088c 100644 --- a/tests/integration/explain/debug/group_with_order_test.go +++ b/tests/integration/explain/debug/group_with_order_test.go @@ -19,12 +19,16 @@ import ( var debugGroupOrderPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "pipeNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "pipeNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -55,7 +59,7 @@ func TestDebugExplainRequestWithDescendingOrderOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugGroupOrderPattern}, + ExpectedPatterns: debugGroupOrderPattern, }, }, } @@ -85,7 +89,7 @@ func TestDebugExplainRequestWithAscendingOrderOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugGroupOrderPattern}, + ExpectedPatterns: debugGroupOrderPattern, }, }, } @@ -115,7 +119,7 @@ func TestDebugExplainRequestWithOrderOnParentGroupByAndOnInnerGroupSelection(t * } }`, - ExpectedPatterns: []dataMap{debugGroupOrderPattern}, + ExpectedPatterns: debugGroupOrderPattern, }, }, } diff --git a/tests/integration/explain/debug/top_with_average_test.go b/tests/integration/explain/debug/top_with_average_test.go index de16b72c4b..a5b656ab7f 100644 --- a/tests/integration/explain/debug/top_with_average_test.go +++ b/tests/integration/explain/debug/top_with_average_test.go @@ -19,23 +19,27 @@ import ( var topLevelAveragePattern = dataMap{ "explain": dataMap{ - "topLevelNode": []dataMap{ + "operationNode": []dataMap{ { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, + }, + { + "sumNode": dataMap{}, + }, + { + "countNode": dataMap{}, + }, + { + "averageNode": dataMap{}, }, }, }, - { - "sumNode": dataMap{}, - }, - { - "countNode": dataMap{}, - }, - { - "averageNode": dataMap{}, - }, }, }, } @@ -58,7 +62,7 @@ func TestDebugExplainTopLevelAverageRequest(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelAveragePattern}, + ExpectedPatterns: topLevelAveragePattern, }, }, } @@ -89,7 +93,7 @@ func TestDebugExplainTopLevelAverageRequestWithFilter(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelAveragePattern}, + ExpectedPatterns: topLevelAveragePattern, }, }, } diff --git a/tests/integration/explain/debug/top_with_count_test.go b/tests/integration/explain/debug/top_with_count_test.go index cceb3d1467..5dd40860bf 100644 --- a/tests/integration/explain/debug/top_with_count_test.go +++ b/tests/integration/explain/debug/top_with_count_test.go @@ -19,17 +19,21 @@ import ( var topLevelCountPattern = dataMap{ "explain": dataMap{ - "topLevelNode": []dataMap{ + "operationNode": []dataMap{ { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, + }, + { + "countNode": dataMap{}, }, }, }, - { - "countNode": dataMap{}, - }, }, }, } @@ -48,7 +52,7 @@ func TestDebugExplainTopLevelCountRequest(t *testing.T) { _count(Author: {}) }`, - ExpectedPatterns: []dataMap{topLevelCountPattern}, + ExpectedPatterns: topLevelCountPattern, }, }, } @@ -78,7 +82,7 @@ func TestDebugExplainTopLevelCountRequestWithFilter(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelCountPattern}, + ExpectedPatterns: topLevelCountPattern, }, }, } diff --git a/tests/integration/explain/debug/top_with_sum_test.go b/tests/integration/explain/debug/top_with_sum_test.go index ba2381a7cf..3c6250c607 100644 --- a/tests/integration/explain/debug/top_with_sum_test.go +++ b/tests/integration/explain/debug/top_with_sum_test.go @@ -19,17 +19,21 @@ import ( var topLevelSumPattern = dataMap{ "explain": dataMap{ - "topLevelNode": []dataMap{ + "operationNode": []dataMap{ { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, + }, + { + "sumNode": dataMap{}, }, }, }, - { - "sumNode": dataMap{}, - }, }, }, } @@ -52,7 +56,7 @@ func TestDebugExplainTopLevelSumRequest(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelSumPattern}, + ExpectedPatterns: topLevelSumPattern, }, }, } @@ -83,7 +87,7 @@ func TestDebugExplainTopLevelSumRequestWithFilter(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelSumPattern}, + ExpectedPatterns: topLevelSumPattern, }, }, } diff --git a/tests/integration/explain/debug/type_join_many_test.go b/tests/integration/explain/debug/type_join_many_test.go index 85ca3399a5..4150e9a85b 100644 --- a/tests/integration/explain/debug/type_join_many_test.go +++ b/tests/integration/explain/debug/type_join_many_test.go @@ -35,13 +35,15 @@ func TestDebugExplainRequestWithAOneToManyJoin(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/type_join_one_test.go b/tests/integration/explain/debug/type_join_one_test.go index 55b1bc9b57..16522c2098 100644 --- a/tests/integration/explain/debug/type_join_one_test.go +++ b/tests/integration/explain/debug/type_join_one_test.go @@ -35,13 +35,15 @@ func TestDebugExplainRequestWithAOneToOneJoin(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinOne": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinOne": normalTypeJoinPattern, + }, }, }, }, @@ -77,21 +79,23 @@ func TestDebugExplainRequestWithTwoLevelDeepNestedJoins(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinOne": dataMap{ - "root": dataMap{ - "scanNode": dataMap{}, - }, - "subType": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinOne": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinOne": dataMap{ + "root": dataMap{ + "scanNode": dataMap{}, + }, + "subType": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinOne": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/type_join_test.go b/tests/integration/explain/debug/type_join_test.go index 21608521c4..8aece904da 100644 --- a/tests/integration/explain/debug/type_join_test.go +++ b/tests/integration/explain/debug/type_join_test.go @@ -70,25 +70,27 @@ func TestDebugExplainRequestWith2SingleJoinsAnd1ManyJoin(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinOne": debugTypeJoinPattern, + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinOne": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinOne": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinOne": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/type_join_with_filter_doc_id_test.go b/tests/integration/explain/debug/type_join_with_filter_doc_id_test.go index 5a8f2c5ba2..351ada42ef 100644 --- a/tests/integration/explain/debug/type_join_with_filter_doc_id_test.go +++ b/tests/integration/explain/debug/type_join_with_filter_doc_id_test.go @@ -43,13 +43,15 @@ func TestDebugExplainRequestWithRelatedAndRegularFilterAndDocIDs(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": normalTypeJoinPattern, + }, }, }, }, @@ -87,20 +89,22 @@ func TestDebugExplainRequestWithManyRelatedFiltersAndDocID(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/type_join_with_filter_test.go b/tests/integration/explain/debug/type_join_with_filter_test.go index 2d4940b5bc..151d7c008d 100644 --- a/tests/integration/explain/debug/type_join_with_filter_test.go +++ b/tests/integration/explain/debug/type_join_with_filter_test.go @@ -39,13 +39,15 @@ func TestDebugExplainRequestWithRelatedAndRegularFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": normalTypeJoinPattern, + }, }, }, }, @@ -82,20 +84,22 @@ func TestDebugExplainRequestWithManyRelatedFilters(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/update_test.go b/tests/integration/explain/debug/update_test.go index d9c190ca0c..dc69553619 100644 --- a/tests/integration/explain/debug/update_test.go +++ b/tests/integration/explain/debug/update_test.go @@ -19,10 +19,14 @@ import ( var updatePattern = dataMap{ "explain": dataMap{ - "updateNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "updateNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -54,7 +58,7 @@ func TestDebugExplainMutationRequestWithUpdateUsingBooleanFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, }, }, } @@ -86,7 +90,7 @@ func TestDebugExplainMutationRequestWithUpdateUsingIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, }, }, } @@ -115,7 +119,7 @@ func TestDebugExplainMutationRequestWithUpdateUsingId(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, }, }, } @@ -152,7 +156,7 @@ func TestDebugExplainMutationRequestWithUpdateUsingIdsAndFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, }, }, } diff --git a/tests/integration/explain/debug/with_average_join_test.go b/tests/integration/explain/debug/with_average_join_test.go index 63d910d117..115d6ca2ca 100644 --- a/tests/integration/explain/debug/with_average_join_test.go +++ b/tests/integration/explain/debug/with_average_join_test.go @@ -19,13 +19,17 @@ import ( var debugAverageTypeIndexJoinManyPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": normalTypeJoinPattern, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": normalTypeJoinPattern, + }, + }, }, }, }, @@ -52,7 +56,7 @@ func TestDebugExplainRequestWithAverageOnJoinedField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugAverageTypeIndexJoinManyPattern}, + ExpectedPatterns: debugAverageTypeIndexJoinManyPattern, }, }, } @@ -80,23 +84,25 @@ func TestDebugExplainRequestWithAverageOnMultipleJoinedFieldsWithFilter(t *testi } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/with_average_test.go b/tests/integration/explain/debug/with_average_test.go index 9bc0f70194..9ae0298457 100644 --- a/tests/integration/explain/debug/with_average_test.go +++ b/tests/integration/explain/debug/with_average_test.go @@ -19,12 +19,16 @@ import ( var averagePattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -50,7 +54,7 @@ func TestDebugExplainRequestWithAverageOnArrayField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{averagePattern}, + ExpectedFullGraph: averagePattern, }, }, } diff --git a/tests/integration/explain/debug/with_count_join_test.go b/tests/integration/explain/debug/with_count_join_test.go index ae96eeb2c5..2caa853f08 100644 --- a/tests/integration/explain/debug/with_count_join_test.go +++ b/tests/integration/explain/debug/with_count_join_test.go @@ -19,11 +19,15 @@ import ( var debugCountTypeIndexJoinManyPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": normalTypeJoinPattern, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": normalTypeJoinPattern, + }, + }, }, }, }, @@ -48,7 +52,7 @@ func TestDebugExplainRequestWithCountOnOneToManyJoinedField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugCountTypeIndexJoinManyPattern}, + ExpectedPatterns: debugCountTypeIndexJoinManyPattern, }, }, } @@ -76,21 +80,23 @@ func TestDebugExplainRequestWithCountOnOneToManyJoinedFieldWithManySources(t *te } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/with_count_test.go b/tests/integration/explain/debug/with_count_test.go index ec542bed8e..57b8328883 100644 --- a/tests/integration/explain/debug/with_count_test.go +++ b/tests/integration/explain/debug/with_count_test.go @@ -19,10 +19,14 @@ import ( var countPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -46,7 +50,7 @@ func TestDebugExplainRequestWithCountOnInlineArrayField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{countPattern}, + ExpectedPatterns: countPattern, }, }, } diff --git a/tests/integration/explain/debug/with_filter_doc_id_test.go b/tests/integration/explain/debug/with_filter_doc_id_test.go index 89bf3f35aa..800a3a3c77 100644 --- a/tests/integration/explain/debug/with_filter_doc_id_test.go +++ b/tests/integration/explain/debug/with_filter_doc_id_test.go @@ -34,7 +34,7 @@ func TestDebugExplainRequestWithDocIDFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -59,7 +59,7 @@ func TestDebugExplainRequestWithDocIDsFilterUsingOneID(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -89,7 +89,7 @@ func TestDebugExplainRequestWithDocIDsFilterUsingMultipleButDuplicateIDs(t *test } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -119,7 +119,7 @@ func TestDebugExplainRequestWithDocIDsFilterUsingMultipleUniqueIDs(t *testing.T) } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -150,7 +150,7 @@ func TestDebugExplainRequestWithMatchingIDFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } diff --git a/tests/integration/explain/debug/with_filter_test.go b/tests/integration/explain/debug/with_filter_test.go index 67f69a406c..f82238f841 100644 --- a/tests/integration/explain/debug/with_filter_test.go +++ b/tests/integration/explain/debug/with_filter_test.go @@ -34,7 +34,7 @@ func TestDebugExplainRequestWithStringEqualFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -59,7 +59,7 @@ func TestDebugExplainRequestWithIntegerEqualFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -84,7 +84,7 @@ func TestDebugExplainRequestWithGreaterThanFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -109,7 +109,7 @@ func TestDebugExplainRequestWithLogicalCompoundAndFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -134,7 +134,7 @@ func TestDebugExplainRequestWithLogicalCompoundOrFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } @@ -159,7 +159,7 @@ func TestDebugExplainRequestWithMatchInsideList(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } diff --git a/tests/integration/explain/debug/with_limit_count_test.go b/tests/integration/explain/debug/with_limit_count_test.go index 84327fdaae..e570bfeebb 100644 --- a/tests/integration/explain/debug/with_limit_count_test.go +++ b/tests/integration/explain/debug/with_limit_count_test.go @@ -36,21 +36,23 @@ func TestDebugExplainRequestWithOnlyLimitOnRelatedChildWithCount(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugLimitTypeJoinManyPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugLimitTypeJoinManyPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, @@ -86,22 +88,24 @@ func TestDebugExplainRequestWithLimitArgsOnParentAndRelatedChildWithCount(t *tes } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugLimitTypeJoinManyPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugLimitTypeJoinManyPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/with_limit_join_test.go b/tests/integration/explain/debug/with_limit_join_test.go index 028ac2f69b..f80bcc3f17 100644 --- a/tests/integration/explain/debug/with_limit_join_test.go +++ b/tests/integration/explain/debug/with_limit_join_test.go @@ -68,13 +68,15 @@ func TestDebugExplainRequestWithOnlyLimitOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": limitTypeJoinPattern, + }, }, }, }, @@ -107,13 +109,15 @@ func TestDebugExplainRequestWithOnlyOffsetOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": limitTypeJoinPattern, + }, }, }, }, @@ -146,13 +150,15 @@ func TestDebugExplainRequestWithBothLimitAndOffsetOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": limitTypeJoinPattern, + }, }, }, }, @@ -185,14 +191,16 @@ func TestDebugExplainRequestWithLimitOnRelatedChildAndBothLimitAndOffsetOnParent } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": limitTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/with_limit_test.go b/tests/integration/explain/debug/with_limit_test.go index 993032a364..8545e59e92 100644 --- a/tests/integration/explain/debug/with_limit_test.go +++ b/tests/integration/explain/debug/with_limit_test.go @@ -19,10 +19,14 @@ import ( var limitPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDebugExplainRequestWithOnlyLimit(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{limitPattern}, + ExpectedPatterns: limitPattern, }, }, } @@ -69,7 +73,7 @@ func TestDebugExplainRequestWithOnlyOffset(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{limitPattern}, + ExpectedPatterns: limitPattern, }, }, } @@ -93,7 +97,7 @@ func TestDebugExplainRequestWithLimitAndOffset(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{limitPattern}, + ExpectedPatterns: limitPattern, }, }, } diff --git a/tests/integration/explain/debug/with_order_join_test.go b/tests/integration/explain/debug/with_order_join_test.go index 02b96496e6..ba67b6256c 100644 --- a/tests/integration/explain/debug/with_order_join_test.go +++ b/tests/integration/explain/debug/with_order_join_test.go @@ -51,13 +51,15 @@ func TestDebugExplainRequestWithOrderFieldOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": orderTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": orderTypeJoinPattern, + }, }, }, }, @@ -90,14 +92,16 @@ func TestDebugExplainRequestWithOrderFieldOnParentAndRelatedChild(t *testing.T) } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": orderTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": orderTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/with_order_test.go b/tests/integration/explain/debug/with_order_test.go index cdcdfe35ac..663514f558 100644 --- a/tests/integration/explain/debug/with_order_test.go +++ b/tests/integration/explain/debug/with_order_test.go @@ -19,10 +19,14 @@ import ( var orderPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -46,7 +50,7 @@ func TestDebugExplainRequestWithAscendingOrderOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{orderPattern}, + ExpectedFullGraph: orderPattern, }, }, } @@ -71,7 +75,7 @@ func TestDebugExplainRequestWithMultiOrderFieldsOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{orderPattern}, + ExpectedFullGraph: orderPattern, }, }, } diff --git a/tests/integration/explain/debug/with_sum_join_test.go b/tests/integration/explain/debug/with_sum_join_test.go index d098eec2f1..815d9c6ee8 100644 --- a/tests/integration/explain/debug/with_sum_join_test.go +++ b/tests/integration/explain/debug/with_sum_join_test.go @@ -19,11 +19,15 @@ import ( var debugSumTypeIndexJoinManyPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "typeJoinMany": normalTypeJoinPattern, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "typeJoinMany": normalTypeJoinPattern, + }, + }, }, }, }, @@ -51,7 +55,7 @@ func TestDebugExplainRequestWithSumOnOneToManyJoinedField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{debugSumTypeIndexJoinManyPattern}, + ExpectedPatterns: debugSumTypeIndexJoinManyPattern, }, }, } @@ -85,7 +89,7 @@ func TestDebugExplainRequestWithSumOnOneToManyJoinedFieldWithFilter(t *testing.T } }`, - ExpectedPatterns: []dataMap{debugSumTypeIndexJoinManyPattern}, + ExpectedPatterns: debugSumTypeIndexJoinManyPattern, }, }, } @@ -113,21 +117,23 @@ func TestDebugExplainRequestWithSumOnOneToManyJoinedFieldWithManySources(t *test } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, - }, - { - "typeIndexJoin": dataMap{ - "typeJoinMany": debugTypeJoinPattern, + { + "typeIndexJoin": dataMap{ + "typeJoinMany": debugTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/debug/with_sum_test.go b/tests/integration/explain/debug/with_sum_test.go index 00ed6ddcc7..eaca8b7c9a 100644 --- a/tests/integration/explain/debug/with_sum_test.go +++ b/tests/integration/explain/debug/with_sum_test.go @@ -19,10 +19,14 @@ import ( var sumPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -46,7 +50,7 @@ func TestDebugExplainRequestWithSumOnInlineArrayField_ChildFieldWillBeEmpty(t *t } }`, - ExpectedPatterns: []dataMap{sumPattern}, + ExpectedPatterns: sumPattern, }, }, } diff --git a/tests/integration/explain/debug/with_view_test.go b/tests/integration/explain/debug/with_view_test.go index 44341ae521..43d83a4dee 100644 --- a/tests/integration/explain/debug/with_view_test.go +++ b/tests/integration/explain/debug/with_view_test.go @@ -18,12 +18,16 @@ import ( var viewPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "viewNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "viewNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -62,7 +66,7 @@ func TestDebugExplainRequestWithView(t *testing.T) { name } }`, - ExpectedPatterns: []dataMap{viewPattern}, + ExpectedPatterns: viewPattern, }, }, } diff --git a/tests/integration/explain/debug/with_view_transform_test.go b/tests/integration/explain/debug/with_view_transform_test.go index 386324067a..b2da390e8a 100644 --- a/tests/integration/explain/debug/with_view_transform_test.go +++ b/tests/integration/explain/debug/with_view_transform_test.go @@ -22,13 +22,17 @@ import ( var transformViewPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "viewNode": dataMap{ - "lensNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "viewNode": dataMap{ + "lensNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -79,7 +83,7 @@ func TestDebugExplainRequestWithViewWithTransform(t *testing.T) { fullName } }`, - ExpectedPatterns: []dataMap{transformViewPattern}, + ExpectedPatterns: transformViewPattern, }, }, } diff --git a/tests/integration/explain/default/basic_test.go b/tests/integration/explain/default/basic_test.go index 30a5810de6..2f02f6c67c 100644 --- a/tests/integration/explain/default/basic_test.go +++ b/tests/integration/explain/default/basic_test.go @@ -59,21 +59,23 @@ func TestDefaultExplainRequestWithFullBasicGraph(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "docIDs": nil, - "filter": nil, - "scanNode": dataMap{ - "filter": nil, - "collectionID": "3", - "collectionName": "Author", - "spans": []dataMap{ - { - "start": "/3", - "end": "/4", + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "docIDs": nil, + "filter": nil, + "scanNode": dataMap{ + "filter": nil, + "collectionID": "3", + "collectionName": "Author", + "spans": []dataMap{ + { + "start": "/3", + "end": "/4", + }, }, }, }, @@ -106,7 +108,7 @@ func TestDefaultExplainWithAlias(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, }, }, } diff --git a/tests/integration/explain/default/create_test.go b/tests/integration/explain/default/create_test.go index 3fdccc8b44..b939ad08fb 100644 --- a/tests/integration/explain/default/create_test.go +++ b/tests/integration/explain/default/create_test.go @@ -19,10 +19,14 @@ import ( var createPattern = dataMap{ "explain": dataMap{ - "createNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "createNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDefaultExplainMutationRequestWithCreate(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{createPattern}, + ExpectedPatterns: createPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -83,7 +87,7 @@ func TestDefaultExplainMutationRequestDoesNotCreateDocGivenDuplicate(t *testing. } }`, - ExpectedPatterns: []dataMap{createPattern}, + ExpectedPatterns: createPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/dagscan_test.go b/tests/integration/explain/default/dagscan_test.go index 321d3c3251..6b216ab061 100644 --- a/tests/integration/explain/default/dagscan_test.go +++ b/tests/integration/explain/default/dagscan_test.go @@ -19,9 +19,13 @@ import ( var dagScanPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "dagScanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "dagScanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDefaultExplainCommitsDagScanQueryOp(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{dagScanPattern}, + ExpectedPatterns: dagScanPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -88,7 +92,7 @@ func TestDefaultExplainCommitsDagScanQueryOpWithoutField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{dagScanPattern}, + ExpectedPatterns: dagScanPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -132,7 +136,7 @@ func TestDefaultExplainLatestCommitsDagScanQueryOp(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{dagScanPattern}, + ExpectedPatterns: dagScanPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -176,7 +180,7 @@ func TestDefaultExplainLatestCommitsDagScanQueryOpWithoutField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{dagScanPattern}, + ExpectedPatterns: dagScanPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/delete_test.go b/tests/integration/explain/default/delete_test.go index 660785f6a4..a8918b9141 100644 --- a/tests/integration/explain/default/delete_test.go +++ b/tests/integration/explain/default/delete_test.go @@ -19,10 +19,14 @@ import ( var deletePattern = dataMap{ "explain": dataMap{ - "deleteNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "deleteNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDefaultExplainMutationRequestWithDeleteUsingFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -104,7 +108,7 @@ func TestDefaultExplainMutationRequestWithDeleteUsingFilterToMatchEverything(t * } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -155,7 +159,7 @@ func TestDefaultExplainMutationRequestWithDeleteUsingId(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -211,7 +215,7 @@ func TestDefaultExplainMutationRequestWithDeleteUsingIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -269,7 +273,7 @@ func TestDefaultExplainMutationRequestWithDeleteUsingNoIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -323,7 +327,7 @@ func TestDefaultExplainMutationRequestWithDeleteUsingFilterAndIds(t *testing.T) } }`, - ExpectedPatterns: []dataMap{deletePattern}, + ExpectedPatterns: deletePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/fixture.go b/tests/integration/explain/default/fixture.go index 399a59ac20..01d1c31238 100644 --- a/tests/integration/explain/default/fixture.go +++ b/tests/integration/explain/default/fixture.go @@ -14,9 +14,13 @@ type dataMap = map[string]any var basicPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, diff --git a/tests/integration/explain/default/group_test.go b/tests/integration/explain/default/group_test.go index d631badcde..7b3cc2872f 100644 --- a/tests/integration/explain/default/group_test.go +++ b/tests/integration/explain/default/group_test.go @@ -19,10 +19,14 @@ import ( var groupPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -48,7 +52,7 @@ func TestDefaultExplainRequestWithGroupByOnParent(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -88,7 +92,7 @@ func TestDefaultExplainRequestWithGroupByTwoFieldsOnParent(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_average_test.go b/tests/integration/explain/default/group_with_average_test.go index 4346ec6a9a..aa04a737a1 100644 --- a/tests/integration/explain/default/group_with_average_test.go +++ b/tests/integration/explain/default/group_with_average_test.go @@ -19,13 +19,17 @@ import ( var groupAveragePattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -52,7 +56,7 @@ func TestDefaultExplainRequestWithGroupByWithAverageOnAnInnerField(t *testing.T) } }`, - ExpectedPatterns: []dataMap{groupAveragePattern}, + ExpectedPatterns: groupAveragePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -143,7 +147,7 @@ func TestDefaultExplainRequestWithAverageInsideTheInnerGroupOnAField(t *testing. } }`, - ExpectedPatterns: []dataMap{groupAveragePattern}, + ExpectedPatterns: groupAveragePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -225,7 +229,7 @@ func TestDefaultExplainRequestWithAverageInsideTheInnerGroupOnAFieldAndNestedGro } }`, - ExpectedPatterns: []dataMap{groupAveragePattern}, + ExpectedPatterns: groupAveragePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -308,7 +312,7 @@ func TestDefaultExplainRequestWithAverageInsideTheInnerGroupAndNestedGroupByWith } }`, - ExpectedPatterns: []dataMap{groupAveragePattern}, + ExpectedPatterns: groupAveragePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_doc_id_child_test.go b/tests/integration/explain/default/group_with_doc_id_child_test.go index 6ce3b8c041..a721bb571a 100644 --- a/tests/integration/explain/default/group_with_doc_id_child_test.go +++ b/tests/integration/explain/default/group_with_doc_id_child_test.go @@ -38,7 +38,7 @@ func TestDefaultExplainRequestWithDocIDsOnInnerGroupSelection(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_doc_id_test.go b/tests/integration/explain/default/group_with_doc_id_test.go index d458ad9015..2178701a4e 100644 --- a/tests/integration/explain/default/group_with_doc_id_test.go +++ b/tests/integration/explain/default/group_with_doc_id_test.go @@ -39,7 +39,7 @@ func TestDefaultExplainRequestWithDocIDOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -101,7 +101,7 @@ func TestDefaultExplainRequestWithDocIDsAndFilterOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_filter_child_test.go b/tests/integration/explain/default/group_with_filter_child_test.go index a8522962eb..9ce44342d1 100644 --- a/tests/integration/explain/default/group_with_filter_child_test.go +++ b/tests/integration/explain/default/group_with_filter_child_test.go @@ -36,7 +36,7 @@ func TestDefaultExplainRequestWithFilterOnInnerGroupSelection(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -105,7 +105,7 @@ func TestDefaultExplainRequestWithFilterOnParentGroupByAndInnerGroupSelection(t } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_filter_test.go b/tests/integration/explain/default/group_with_filter_test.go index 6221fd0f02..23651934e3 100644 --- a/tests/integration/explain/default/group_with_filter_test.go +++ b/tests/integration/explain/default/group_with_filter_test.go @@ -39,7 +39,7 @@ func TestDefaultExplainRequestWithFilterOnGroupByParent(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_limit_child_test.go b/tests/integration/explain/default/group_with_limit_child_test.go index fb6dc83f77..a62859aeda 100644 --- a/tests/integration/explain/default/group_with_limit_child_test.go +++ b/tests/integration/explain/default/group_with_limit_child_test.go @@ -36,7 +36,7 @@ func TestDefaultExplainRequestWithLimitAndOffsetOnInnerGroupSelection(t *testing } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -89,7 +89,7 @@ func TestDefaultExplainRequestWithLimitAndOffsetOnMultipleInnerGroupSelections(t } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_limit_test.go b/tests/integration/explain/default/group_with_limit_test.go index b88496c7dd..1696e3ccd2 100644 --- a/tests/integration/explain/default/group_with_limit_test.go +++ b/tests/integration/explain/default/group_with_limit_test.go @@ -19,11 +19,15 @@ import ( var groupLimitPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -54,7 +58,7 @@ func TestDefaultExplainRequestWithLimitAndOffsetOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupLimitPattern}, + ExpectedPatterns: groupLimitPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -105,7 +109,7 @@ func TestDefaultExplainRequestWithLimitOnParentGroupByAndInnerGroupSelection(t * } }`, - ExpectedPatterns: []dataMap{groupLimitPattern}, + ExpectedPatterns: groupLimitPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_order_child_test.go b/tests/integration/explain/default/group_with_order_child_test.go index e8ba14d697..969f048c0c 100644 --- a/tests/integration/explain/default/group_with_order_child_test.go +++ b/tests/integration/explain/default/group_with_order_child_test.go @@ -36,7 +36,7 @@ func TestDefaultExplainRequestWithDescendingOrderOnInnerGroupSelection(t *testin } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -88,7 +88,7 @@ func TestDefaultExplainRequestWithAscendingOrderOnInnerGroupSelection(t *testing } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -146,7 +146,7 @@ func TestDefaultExplainRequestWithOrderOnNestedParentGroupByAndOnNestedParentsIn } }`, - ExpectedPatterns: []dataMap{groupPattern}, + ExpectedPatterns: groupPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/group_with_order_test.go b/tests/integration/explain/default/group_with_order_test.go index 43e6b7ba05..4ab526474e 100644 --- a/tests/integration/explain/default/group_with_order_test.go +++ b/tests/integration/explain/default/group_with_order_test.go @@ -19,11 +19,15 @@ import ( var groupOrderPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "groupNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "groupNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -53,7 +57,7 @@ func TestDefaultExplainRequestWithDescendingOrderOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupOrderPattern}, + ExpectedPatterns: groupOrderPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -108,7 +112,7 @@ func TestDefaultExplainRequestWithAscendingOrderOnParentGroupBy(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{groupOrderPattern}, + ExpectedPatterns: groupOrderPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -163,7 +167,7 @@ func TestDefaultExplainRequestWithOrderOnParentGroupByAndOnInnerGroupSelection(t } }`, - ExpectedPatterns: []dataMap{groupOrderPattern}, + ExpectedPatterns: groupOrderPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/top_with_average_test.go b/tests/integration/explain/default/top_with_average_test.go index 249aa209e9..1921a142f7 100644 --- a/tests/integration/explain/default/top_with_average_test.go +++ b/tests/integration/explain/default/top_with_average_test.go @@ -19,23 +19,27 @@ import ( var topLevelAveragePattern = dataMap{ "explain": dataMap{ - "topLevelNode": []dataMap{ + "operationNode": []dataMap{ { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, + }, + { + "sumNode": dataMap{}, + }, + { + "countNode": dataMap{}, + }, + { + "averageNode": dataMap{}, }, }, }, - { - "sumNode": dataMap{}, - }, - { - "countNode": dataMap{}, - }, - { - "averageNode": dataMap{}, - }, }, }, } @@ -58,7 +62,7 @@ func TestDefaultExplainTopLevelAverageRequest(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelAveragePattern}, + ExpectedPatterns: topLevelAveragePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -149,7 +153,7 @@ func TestDefaultExplainTopLevelAverageRequestWithFilter(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelAveragePattern}, + ExpectedPatterns: topLevelAveragePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/top_with_count_test.go b/tests/integration/explain/default/top_with_count_test.go index 8129013911..6ac039f764 100644 --- a/tests/integration/explain/default/top_with_count_test.go +++ b/tests/integration/explain/default/top_with_count_test.go @@ -19,17 +19,21 @@ import ( var topLevelCountPattern = dataMap{ "explain": dataMap{ - "topLevelNode": []dataMap{ + "operationNode": []dataMap{ { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, + }, + { + "countNode": dataMap{}, }, }, }, - { - "countNode": dataMap{}, - }, }, }, } @@ -48,7 +52,7 @@ func TestDefaultExplainTopLevelCountRequest(t *testing.T) { _count(Author: {}) }`, - ExpectedPatterns: []dataMap{topLevelCountPattern}, + ExpectedPatterns: topLevelCountPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -108,7 +112,7 @@ func TestDefaultExplainTopLevelCountRequestWithFilter(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelCountPattern}, + ExpectedPatterns: topLevelCountPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/top_with_sum_test.go b/tests/integration/explain/default/top_with_sum_test.go index 764663a8bd..a2927beb25 100644 --- a/tests/integration/explain/default/top_with_sum_test.go +++ b/tests/integration/explain/default/top_with_sum_test.go @@ -19,17 +19,21 @@ import ( var topLevelSumPattern = dataMap{ "explain": dataMap{ - "topLevelNode": []dataMap{ + "operationNode": []dataMap{ { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, + }, + { + "sumNode": dataMap{}, }, }, }, - { - "sumNode": dataMap{}, - }, }, }, } @@ -52,7 +56,7 @@ func TestDefaultExplainTopLevelSumRequest(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelSumPattern}, + ExpectedPatterns: topLevelSumPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -114,7 +118,7 @@ func TestDefaultExplainTopLevelSumRequestWithFilter(t *testing.T) { ) }`, - ExpectedPatterns: []dataMap{topLevelSumPattern}, + ExpectedPatterns: topLevelSumPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/type_join_many_test.go b/tests/integration/explain/default/type_join_many_test.go index 031b509950..30bd530a99 100644 --- a/tests/integration/explain/default/type_join_many_test.go +++ b/tests/integration/explain/default/type_join_many_test.go @@ -37,12 +37,14 @@ func TestDefaultExplainRequestWithAOneToManyJoin(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/type_join_one_test.go b/tests/integration/explain/default/type_join_one_test.go index 3059bf8528..05daf41539 100644 --- a/tests/integration/explain/default/type_join_one_test.go +++ b/tests/integration/explain/default/type_join_one_test.go @@ -37,12 +37,14 @@ func TestDefaultExplainRequestWithAOneToOneJoin(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -134,19 +136,21 @@ func TestDefaultExplainRequestWithTwoLevelDeepNestedJoins(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": dataMap{ - "root": dataMap{ - "scanNode": dataMap{}, - }, - "subType": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": dataMap{ + "root": dataMap{ + "scanNode": dataMap{}, + }, + "subType": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/type_join_test.go b/tests/integration/explain/default/type_join_test.go index c09c1b0f12..5f4d93df3b 100644 --- a/tests/integration/explain/default/type_join_test.go +++ b/tests/integration/explain/default/type_join_test.go @@ -57,20 +57,22 @@ func TestDefaultExplainRequestWith2SingleJoinsAnd1ManyJoin(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/type_join_with_filter_doc_id_test.go b/tests/integration/explain/default/type_join_with_filter_doc_id_test.go index 7b320b01b7..63aa689fa6 100644 --- a/tests/integration/explain/default/type_join_with_filter_doc_id_test.go +++ b/tests/integration/explain/default/type_join_with_filter_doc_id_test.go @@ -43,12 +43,14 @@ func TestDefaultExplainRequestWithRelatedAndRegularFilterAndDocIDs(t *testing.T) } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -127,17 +129,19 @@ func TestDefaultExplainRequestWithManyRelatedFiltersAndDocID(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/type_join_with_filter_test.go b/tests/integration/explain/default/type_join_with_filter_test.go index 78ed484b0c..43880c9d79 100644 --- a/tests/integration/explain/default/type_join_with_filter_test.go +++ b/tests/integration/explain/default/type_join_with_filter_test.go @@ -39,12 +39,14 @@ func TestDefaultExplainRequestWithRelatedAndRegularFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -115,17 +117,19 @@ func TestDefaultExplainRequestWithManyRelatedFilters(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/update_test.go b/tests/integration/explain/default/update_test.go index e2d52e8b73..12f69568dd 100644 --- a/tests/integration/explain/default/update_test.go +++ b/tests/integration/explain/default/update_test.go @@ -19,10 +19,14 @@ import ( var updatePattern = dataMap{ "explain": dataMap{ - "updateNode": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "updateNode": dataMap{ + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -54,7 +58,7 @@ func TestDefaultExplainMutationRequestWithUpdateUsingBooleanFilter(t *testing.T) } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -123,7 +127,7 @@ func TestDefaultExplainMutationRequestWithUpdateUsingIds(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -188,7 +192,7 @@ func TestDefaultExplainMutationRequestWithUpdateUsingId(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -256,7 +260,7 @@ func TestDefaultExplainMutationRequestWithUpdateUsingIdsAndFilter(t *testing.T) } }`, - ExpectedPatterns: []dataMap{updatePattern}, + ExpectedPatterns: updatePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_average_join_test.go b/tests/integration/explain/default/with_average_join_test.go index d1cd68046e..5d65408540 100644 --- a/tests/integration/explain/default/with_average_join_test.go +++ b/tests/integration/explain/default/with_average_join_test.go @@ -21,12 +21,16 @@ import ( var averageTypeIndexJoinPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, + }, }, }, }, @@ -52,7 +56,7 @@ func TestDefaultExplainRequestWithAverageOnJoinedField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{averageTypeIndexJoinPattern}, + ExpectedPatterns: averageTypeIndexJoinPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -166,20 +170,22 @@ func TestDefaultExplainRequestWithAverageOnMultipleJoinedFieldsWithFilter(t *tes } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -372,15 +378,17 @@ func TestDefaultExplainRequestOneToManyWithAverageAndChildNeNilFilterSharesJoinF } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/with_average_test.go b/tests/integration/explain/default/with_average_test.go index 41198fd88a..71a66aa6f8 100644 --- a/tests/integration/explain/default/with_average_test.go +++ b/tests/integration/explain/default/with_average_test.go @@ -19,12 +19,16 @@ import ( var averagePattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "countNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ + "countNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -50,7 +54,7 @@ func TestDefaultExplainRequestWithAverageOnArrayField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{averagePattern}, + ExpectedPatterns: averagePattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_count_join_test.go b/tests/integration/explain/default/with_count_join_test.go index 4833354bba..a406855b71 100644 --- a/tests/integration/explain/default/with_count_join_test.go +++ b/tests/integration/explain/default/with_count_join_test.go @@ -21,10 +21,14 @@ import ( var countTypeIndexJoinPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, + }, }, }, }, @@ -48,7 +52,7 @@ func TestDefaultExplainRequestWithCountOnOneToManyJoinedField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{countTypeIndexJoinPattern}, + ExpectedPatterns: countTypeIndexJoinPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -132,18 +136,20 @@ func TestDefaultExplainRequestWithCountOnOneToManyJoinedFieldWithManySources(t * } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -285,13 +291,15 @@ func TestDefaultExplainRequestOneToManyWithCountWithFilterAndChildFilterSharesJo } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -327,18 +335,20 @@ func TestDefaultExplainRequestOneToManyWithCountAndChildFilterDoesNotShareJoinFi } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/with_count_test.go b/tests/integration/explain/default/with_count_test.go index 212a4464c9..311c52d599 100644 --- a/tests/integration/explain/default/with_count_test.go +++ b/tests/integration/explain/default/with_count_test.go @@ -19,10 +19,14 @@ import ( var countPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -46,7 +50,7 @@ func TestDefaultExplainRequestWithCountOnInlineArrayField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{countPattern}, + ExpectedPatterns: countPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_filter_doc_id_test.go b/tests/integration/explain/default/with_filter_doc_id_test.go index a5807d1da7..4e69361e2e 100644 --- a/tests/integration/explain/default/with_filter_doc_id_test.go +++ b/tests/integration/explain/default/with_filter_doc_id_test.go @@ -34,7 +34,7 @@ func TestDefaultExplainRequestWithDocIDFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -86,7 +86,7 @@ func TestDefaultExplainRequestWithDocIDsFilterUsingOneID(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -143,7 +143,7 @@ func TestDefaultExplainRequestWithDocIDsFilterUsingMultipleButDuplicateIDs(t *te } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -205,7 +205,7 @@ func TestDefaultExplainRequestWithDocIDsFilterUsingMultipleUniqueIDs(t *testing. } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -268,7 +268,7 @@ func TestDefaultExplainRequestWithMatchingIDFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_filter_test.go b/tests/integration/explain/default/with_filter_test.go index a165f28876..2d3751f562 100644 --- a/tests/integration/explain/default/with_filter_test.go +++ b/tests/integration/explain/default/with_filter_test.go @@ -34,7 +34,7 @@ func TestDefaultExplainRequestWithStringEqualFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -81,7 +81,7 @@ func TestDefaultExplainRequestWithIntegerEqualFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -128,7 +128,7 @@ func TestDefaultExplainRequestWithGreaterThanFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -175,7 +175,7 @@ func TestDefaultExplainRequestWithLogicalCompoundAndFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -231,7 +231,7 @@ func TestDefaultExplainRequestWithLogicalCompoundOrFilter(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -287,7 +287,7 @@ func TestDefaultExplainRequestWithMatchInsideList(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{basicPattern}, + ExpectedPatterns: basicPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_limit_count_test.go b/tests/integration/explain/default/with_limit_count_test.go index 5ac40a24c5..ab440a62b4 100644 --- a/tests/integration/explain/default/with_limit_count_test.go +++ b/tests/integration/explain/default/with_limit_count_test.go @@ -36,18 +36,20 @@ func TestDefaultExplainRequestWithOnlyLimitOnRelatedChildWithCount(t *testing.T) } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": limitTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": limitTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, @@ -105,19 +107,21 @@ func TestDefaultExplainRequestWithLimitArgsOnParentAndRelatedChildWithCount(t *t } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "countNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": limitTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "countNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": limitTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/with_limit_join_test.go b/tests/integration/explain/default/with_limit_join_test.go index c56af3d646..5216cdc75d 100644 --- a/tests/integration/explain/default/with_limit_join_test.go +++ b/tests/integration/explain/default/with_limit_join_test.go @@ -51,12 +51,14 @@ func TestDefaultExplainRequestWithOnlyLimitOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": limitTypeJoinPattern, + }, }, }, }, @@ -99,12 +101,14 @@ func TestDefaultExplainRequestWithOnlyOffsetOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": limitTypeJoinPattern, + }, }, }, }, @@ -147,12 +151,14 @@ func TestDefaultExplainRequestWithBothLimitAndOffsetOnRelatedChild(t *testing.T) } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": limitTypeJoinPattern, + }, }, }, }, @@ -195,13 +201,15 @@ func TestDefaultExplainRequestWithLimitOnRelatedChildAndBothLimitAndOffsetOnPare } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": limitTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": limitTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/with_limit_test.go b/tests/integration/explain/default/with_limit_test.go index 0d2ebbae23..8a5a86972b 100644 --- a/tests/integration/explain/default/with_limit_test.go +++ b/tests/integration/explain/default/with_limit_test.go @@ -19,10 +19,14 @@ import ( var limitPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -45,7 +49,7 @@ func TestDefaultExplainRequestWithOnlyLimit(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{limitPattern}, + ExpectedPatterns: limitPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -80,7 +84,7 @@ func TestDefaultExplainRequestWithOnlyOffset(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{limitPattern}, + ExpectedPatterns: limitPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -115,7 +119,7 @@ func TestDefaultExplainRequestWithLimitAndOffset(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{limitPattern}, + ExpectedPatterns: limitPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_order_join_test.go b/tests/integration/explain/default/with_order_join_test.go index ddffdeb776..1f1388ff51 100644 --- a/tests/integration/explain/default/with_order_join_test.go +++ b/tests/integration/explain/default/with_order_join_test.go @@ -51,12 +51,14 @@ func TestDefaultExplainRequestWithOrderFieldOnRelatedChild(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": orderTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": orderTypeJoinPattern, + }, }, }, }, @@ -105,13 +107,15 @@ func TestDefaultExplainRequestWithOrderFieldOnParentAndRelatedChild(t *testing.T } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": orderTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": orderTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/with_order_test.go b/tests/integration/explain/default/with_order_test.go index fda0eda753..6f0e3909f0 100644 --- a/tests/integration/explain/default/with_order_test.go +++ b/tests/integration/explain/default/with_order_test.go @@ -19,10 +19,14 @@ import ( var orderPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -46,7 +50,7 @@ func TestDefaultExplainRequestWithAscendingOrderOnParent(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{orderPattern}, + ExpectedPatterns: orderPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -88,7 +92,7 @@ func TestDefaultExplainRequestWithMultiOrderFieldsOnParent(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{orderPattern}, + ExpectedPatterns: orderPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/default/with_sum_join_test.go b/tests/integration/explain/default/with_sum_join_test.go index 0889b3bd85..d2b7b6dc64 100644 --- a/tests/integration/explain/default/with_sum_join_test.go +++ b/tests/integration/explain/default/with_sum_join_test.go @@ -21,10 +21,14 @@ import ( var sumTypeIndexJoinPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "typeIndexJoin": normalTypeJoinPattern, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "typeIndexJoin": normalTypeJoinPattern, + }, + }, }, }, }, @@ -51,7 +55,7 @@ func TestDefaultExplainRequestWithSumOnOneToManyJoinedField(t *testing.T) { } }`, - ExpectedPatterns: []dataMap{sumTypeIndexJoinPattern}, + ExpectedPatterns: sumTypeIndexJoinPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -142,7 +146,7 @@ func TestDefaultExplainRequestWithSumOnOneToManyJoinedFieldWithFilter(t *testing } }`, - ExpectedPatterns: []dataMap{sumTypeIndexJoinPattern}, + ExpectedPatterns: sumTypeIndexJoinPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { @@ -235,18 +239,20 @@ func TestDefaultExplainRequestWithSumOnOneToManyJoinedFieldWithManySources(t *te } }`, - ExpectedPatterns: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "parallelNode": []dataMap{ - { - "typeIndexJoin": normalTypeJoinPattern, - }, - { - "typeIndexJoin": normalTypeJoinPattern, + ExpectedPatterns: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "parallelNode": []dataMap{ + { + "typeIndexJoin": normalTypeJoinPattern, + }, + { + "typeIndexJoin": normalTypeJoinPattern, + }, }, }, }, diff --git a/tests/integration/explain/default/with_sum_test.go b/tests/integration/explain/default/with_sum_test.go index f7fbc8e715..2f1673ce3a 100644 --- a/tests/integration/explain/default/with_sum_test.go +++ b/tests/integration/explain/default/with_sum_test.go @@ -19,10 +19,14 @@ import ( var sumPattern = dataMap{ "explain": dataMap{ - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "selectNode": dataMap{ - "scanNode": dataMap{}, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "selectNode": dataMap{ + "scanNode": dataMap{}, + }, + }, }, }, }, @@ -46,7 +50,7 @@ func TestDefaultExplainRequestWithSumOnInlineArrayField_ChildFieldWillBeEmpty(t } }`, - ExpectedPatterns: []dataMap{sumPattern}, + ExpectedPatterns: sumPattern, ExpectedTargets: []testUtils.PlanNodeTargetCase{ { diff --git a/tests/integration/explain/execute/create_test.go b/tests/integration/explain/execute/create_test.go index 54876b57f5..29816b47c6 100644 --- a/tests/integration/explain/execute/create_test.go +++ b/tests/integration/explain/execute/create_test.go @@ -32,23 +32,25 @@ func TestExecuteExplainMutationRequestWithCreate(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "createNode": dataMap{ - "iterations": uint64(2), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(1), - "scanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(1), - "fieldFetches": uint64(1), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "createNode": dataMap{ + "iterations": uint64(2), + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(1), + "scanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(1), + "fieldFetches": uint64(1), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/dagscan_test.go b/tests/integration/explain/execute/dagscan_test.go index 524e2a1204..8093accba4 100644 --- a/tests/integration/explain/execute/dagscan_test.go +++ b/tests/integration/explain/execute/dagscan_test.go @@ -37,18 +37,20 @@ func TestExecuteExplainCommitsDagScan(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 5, - "planExecutions": uint64(6), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(6), - "filterMatches": uint64(5), - "dagScanNode": dataMap{ - "iterations": uint64(6), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(6), + "filterMatches": uint64(5), + "dagScanNode": dataMap{ + "iterations": uint64(6), + }, }, }, }, @@ -83,18 +85,20 @@ func TestExecuteExplainLatestCommitsDagScan(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(1), - "dagScanNode": dataMap{ - "iterations": uint64(2), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(1), + "dagScanNode": dataMap{ + "iterations": uint64(2), + }, }, }, }, diff --git a/tests/integration/explain/execute/delete_test.go b/tests/integration/explain/execute/delete_test.go index 99edd857a3..2d29f3a276 100644 --- a/tests/integration/explain/execute/delete_test.go +++ b/tests/integration/explain/execute/delete_test.go @@ -35,23 +35,25 @@ func TestExecuteExplainMutationRequestWithDeleteUsingID(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "deleteNode": dataMap{ - "iterations": uint64(2), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(1), - "scanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(1), - "fieldFetches": uint64(1), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "deleteNode": dataMap{ + "iterations": uint64(2), + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(1), + "scanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(1), + "fieldFetches": uint64(1), + "indexFetches": uint64(0), + }, }, }, }, @@ -84,23 +86,25 @@ func TestExecuteExplainMutationRequestWithDeleteUsingFilter(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "deleteNode": dataMap{ - "iterations": uint64(2), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(1), - "scanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "deleteNode": dataMap{ + "iterations": uint64(2), + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(1), + "scanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/group_test.go b/tests/integration/explain/execute/group_test.go index 9d4dc096f9..6bd0870a38 100644 --- a/tests/integration/explain/execute/group_test.go +++ b/tests/integration/explain/execute/group_test.go @@ -38,28 +38,30 @@ func TestExecuteExplainRequestWithGroup(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "selectTopNode": dataMap{ - "groupNode": dataMap{ - "iterations": uint64(2), - "groups": uint64(1), - "childSelections": uint64(1), - "hiddenBeforeOffset": uint64(0), - "hiddenAfterLimit": uint64(0), - "hiddenChildSelections": uint64(0), - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(4), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "groupNode": dataMap{ + "iterations": uint64(2), + "groups": uint64(1), + "childSelections": uint64(1), + "hiddenBeforeOffset": uint64(0), + "hiddenAfterLimit": uint64(0), + "hiddenChildSelections": uint64(0), + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(4), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/query_deleted_docs_test.go b/tests/integration/explain/execute/query_deleted_docs_test.go index 77a3b3708a..e925910bb6 100644 --- a/tests/integration/explain/execute/query_deleted_docs_test.go +++ b/tests/integration/explain/execute/query_deleted_docs_test.go @@ -30,8 +30,10 @@ func TestExecuteExplainQueryDeletedDocs(t *testing.T) { _docID } }`, - Results: []map[string]any{ - {"_docID": "bae-49f715e7-7f01-5509-a213-ed98cb81583f"}, + Results: map[string]any{ + "delete_ContactAddress": []map[string]any{ + {"_docID": "bae-49f715e7-7f01-5509-a213-ed98cb81583f"}, + }, }, }, testUtils.ExplainRequest{ @@ -42,21 +44,23 @@ func TestExecuteExplainQueryDeletedDocs(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/scan_test.go b/tests/integration/explain/execute/scan_test.go index a68f175015..b2c3192e43 100644 --- a/tests/integration/explain/execute/scan_test.go +++ b/tests/integration/explain/execute/scan_test.go @@ -53,21 +53,23 @@ func TestExecuteExplainRequestWithAllDocumentsMatching(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, @@ -96,21 +98,23 @@ func TestExecuteExplainRequestWithNoDocuments(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 0, - "planExecutions": uint64(1), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(1), - "filterMatches": uint64(0), - "scanNode": dataMap{ - "iterations": uint64(1), - "docFetches": uint64(0), - "fieldFetches": uint64(0), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(1), + "filterMatches": uint64(0), + "scanNode": dataMap{ + "iterations": uint64(1), + "docFetches": uint64(0), + "fieldFetches": uint64(0), + "indexFetches": uint64(0), + }, }, }, }, @@ -160,21 +164,23 @@ func TestExecuteExplainRequestWithSomeDocumentsMatching(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "planExecutions": uint64(2), - "sizeOfResult": 1, - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(1), - "scanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "planExecutions": uint64(2), + "sizeOfResult": 1, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(1), + "scanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, @@ -224,21 +230,23 @@ func TestExecuteExplainRequestWithDocumentsButNoMatches(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "planExecutions": uint64(1), - "sizeOfResult": 0, - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(1), - "filterMatches": uint64(0), - "scanNode": dataMap{ - "iterations": uint64(1), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "planExecutions": uint64(2), + "sizeOfResult": 1, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(1), + "filterMatches": uint64(0), + "scanNode": dataMap{ + "iterations": uint64(1), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/top_level_test.go b/tests/integration/explain/execute/top_level_test.go index 360c9a3d2c..784d7fe8a9 100644 --- a/tests/integration/explain/execute/top_level_test.go +++ b/tests/integration/explain/execute/top_level_test.go @@ -54,44 +54,46 @@ func TestExecuteExplainTopLevelAverageRequest(t *testing.T) { ) }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "topLevelNode": []dataMap{ - { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, }, }, }, - }, - { - "sumNode": dataMap{ - "iterations": uint64(1), + { + "sumNode": dataMap{ + "iterations": uint64(1), + }, }, - }, - { - "countNode": dataMap{ - "iterations": uint64(1), + { + "countNode": dataMap{ + "iterations": uint64(1), + }, }, - }, - { - "averageNode": dataMap{ + { + "averageNode": dataMap{ - "iterations": uint64(1), + "iterations": uint64(1), + }, }, }, }, @@ -138,31 +140,33 @@ func TestExecuteExplainTopLevelCountRequest(t *testing.T) { _count(Author: {}) }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "topLevelNode": []dataMap{ - { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, - }, - { - "countNode": dataMap{ - "iterations": uint64(1), + { + "countNode": dataMap{ + "iterations": uint64(1), + }, }, }, }, @@ -213,31 +217,33 @@ func TestExecuteExplainTopLevelSumRequest(t *testing.T) { ) }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "topLevelNode": []dataMap{ - { - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "topLevelNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, }, }, }, - }, - { - "sumNode": dataMap{ - "iterations": uint64(1), + { + "sumNode": dataMap{ + "iterations": uint64(1), + }, }, }, }, diff --git a/tests/integration/explain/execute/type_join_test.go b/tests/integration/explain/execute/type_join_test.go index ab89890f02..60f717a84f 100644 --- a/tests/integration/explain/execute/type_join_test.go +++ b/tests/integration/explain/execute/type_join_test.go @@ -40,29 +40,31 @@ func TestExecuteExplainRequestWithAOneToOneJoin(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, }, }, }, @@ -104,48 +106,50 @@ func TestExecuteExplainWithMultipleOneToOneJoins(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "parallelNode": []dataMap{ - { - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "parallelNode": []dataMap{ + { + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, }, }, - }, - { - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + { + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, @@ -187,29 +191,31 @@ func TestExecuteExplainWithTwoLevelDeepNestedJoins(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/update_test.go b/tests/integration/explain/execute/update_test.go index 0eaf8cbb22..4ed5e471c2 100644 --- a/tests/integration/explain/execute/update_test.go +++ b/tests/integration/explain/execute/update_test.go @@ -42,24 +42,26 @@ func TestExecuteExplainMutationRequestWithUpdateUsingIDs(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "updateNode": dataMap{ - "iterations": uint64(3), - "updates": uint64(2), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(6), - "filterMatches": uint64(4), - "scanNode": dataMap{ - "iterations": uint64(6), - "docFetches": uint64(4), - "fieldFetches": uint64(8), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "updateNode": dataMap{ + "iterations": uint64(3), + "updates": uint64(2), + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(6), + "filterMatches": uint64(4), + "scanNode": dataMap{ + "iterations": uint64(6), + "docFetches": uint64(4), + "fieldFetches": uint64(8), + "indexFetches": uint64(0), + }, }, }, }, @@ -100,24 +102,26 @@ func TestExecuteExplainMutationRequestWithUpdateUsingFilter(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "updateNode": dataMap{ - "iterations": uint64(2), - "updates": uint64(1), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(4), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(4), - "docFetches": uint64(4), - "fieldFetches": uint64(6), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "updateNode": dataMap{ + "iterations": uint64(2), + "updates": uint64(1), + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(4), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(4), + "docFetches": uint64(4), + "fieldFetches": uint64(6), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/with_average_test.go b/tests/integration/explain/execute/with_average_test.go index 33a238eb68..1c81ce5021 100644 --- a/tests/integration/explain/execute/with_average_test.go +++ b/tests/integration/explain/execute/with_average_test.go @@ -35,27 +35,29 @@ func TestExecuteExplainAverageRequestOnArrayField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 3, - "planExecutions": uint64(4), - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "iterations": uint64(4), - "countNode": dataMap{ + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ "iterations": uint64(4), - "sumNode": dataMap{ + "countNode": dataMap{ "iterations": uint64(4), - "selectNode": dataMap{ - "iterations": uint64(4), - "filterMatches": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(4), - "docFetches": uint64(3), - "fieldFetches": uint64(5), - "indexFetches": uint64(0), + "sumNode": dataMap{ + "iterations": uint64(4), + "selectNode": dataMap{ + "iterations": uint64(4), + "filterMatches": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(4), + "docFetches": uint64(3), + "fieldFetches": uint64(5), + "indexFetches": uint64(0), + }, }, }, }, @@ -90,35 +92,37 @@ func TestExplainExplainAverageRequestOnJoinedField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "averageNode": dataMap{ - "iterations": uint64(3), - "countNode": dataMap{ + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "averageNode": dataMap{ "iterations": uint64(3), - "sumNode": dataMap{ + "countNode": dataMap{ "iterations": uint64(3), - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(5), - "docFetches": uint64(6), - "fieldFetches": uint64(12), - "indexFetches": uint64(0), + "sumNode": dataMap{ + "iterations": uint64(3), + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(5), + "docFetches": uint64(6), + "fieldFetches": uint64(12), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/with_count_test.go b/tests/integration/explain/execute/with_count_test.go index 23858e49d2..81dafce0d9 100644 --- a/tests/integration/explain/execute/with_count_test.go +++ b/tests/integration/explain/execute/with_count_test.go @@ -36,31 +36,33 @@ func TestExecuteExplainRequestWithCountOnOneToManyRelation(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "countNode": dataMap{ - "iterations": uint64(3), - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(5), - "docFetches": uint64(6), - "fieldFetches": uint64(6), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "countNode": dataMap{ + "iterations": uint64(3), + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(5), + "docFetches": uint64(6), + "fieldFetches": uint64(6), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/with_limit_test.go b/tests/integration/explain/execute/with_limit_test.go index cc703c9082..1f40902525 100644 --- a/tests/integration/explain/execute/with_limit_test.go +++ b/tests/integration/explain/execute/with_limit_test.go @@ -34,23 +34,25 @@ func TestExecuteExplainRequestWithBothLimitAndOffsetOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 1, - "planExecutions": uint64(2), - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "iterations": uint64(2), - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "iterations": uint64(2), + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, }, }, }, @@ -86,31 +88,33 @@ func TestExecuteExplainRequestWithBothLimitAndOffsetOnParentAndLimitOnChild(t *t } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "planExecutions": uint64(2), - "sizeOfResult": 1, - "selectTopNode": dataMap{ - "limitNode": dataMap{ - "iterations": uint64(2), - "selectNode": dataMap{ - "iterations": uint64(2), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(2), - "scanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(2), - "docFetches": uint64(3), - "fieldFetches": uint64(5), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "planExecutions": uint64(2), + "sizeOfResult": 1, + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "limitNode": dataMap{ + "iterations": uint64(2), + "selectNode": dataMap{ + "iterations": uint64(2), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(2), + "scanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(2), + "docFetches": uint64(3), + "fieldFetches": uint64(5), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/with_order_test.go b/tests/integration/explain/execute/with_order_test.go index a2441b9cd5..8b27cdbf04 100644 --- a/tests/integration/explain/execute/with_order_test.go +++ b/tests/integration/explain/execute/with_order_test.go @@ -36,23 +36,25 @@ func TestExecuteExplainRequestWithOrderFieldOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "iterations": uint64(3), - "selectNode": dataMap{ - "filterMatches": uint64(2), - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "iterations": uint64(3), + "selectNode": dataMap{ + "filterMatches": uint64(2), + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, }, }, }, @@ -120,23 +122,25 @@ func TestExecuteExplainRequestWithMultiOrderFieldsOnParent(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 4, - "planExecutions": uint64(5), - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "iterations": uint64(5), - "selectNode": dataMap{ - "filterMatches": uint64(4), - "iterations": uint64(5), - "scanNode": dataMap{ - "iterations": uint64(5), - "docFetches": uint64(4), - "fieldFetches": uint64(8), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "iterations": uint64(5), + "selectNode": dataMap{ + "filterMatches": uint64(4), + "iterations": uint64(5), + "scanNode": dataMap{ + "iterations": uint64(5), + "docFetches": uint64(4), + "fieldFetches": uint64(8), + "indexFetches": uint64(0), + }, }, }, }, @@ -172,29 +176,31 @@ func TestExecuteExplainRequestWithOrderFieldOnChild(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(5), - "docFetches": uint64(6), - "fieldFetches": uint64(9), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(5), + "docFetches": uint64(6), + "fieldFetches": uint64(9), + "indexFetches": uint64(0), + }, }, }, }, @@ -231,31 +237,33 @@ func TestExecuteExplainRequestWithOrderFieldOnBothParentAndChild(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "orderNode": dataMap{ - "iterations": uint64(3), - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(4), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(5), - "docFetches": uint64(6), - "fieldFetches": uint64(9), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "orderNode": dataMap{ + "iterations": uint64(3), + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(4), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(5), + "docFetches": uint64(6), + "fieldFetches": uint64(9), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/execute/with_sum_test.go b/tests/integration/explain/execute/with_sum_test.go index e9e3462045..dbc6b3761f 100644 --- a/tests/integration/explain/execute/with_sum_test.go +++ b/tests/integration/explain/execute/with_sum_test.go @@ -35,23 +35,25 @@ func TestExecuteExplainRequestWithSumOfInlineArrayField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 3, - "planExecutions": uint64(4), - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "iterations": uint64(4), - "selectNode": dataMap{ - "iterations": uint64(4), - "filterMatches": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(4), - "docFetches": uint64(3), - "fieldFetches": uint64(5), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "iterations": uint64(4), + "selectNode": dataMap{ + "iterations": uint64(4), + "filterMatches": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(4), + "docFetches": uint64(3), + "fieldFetches": uint64(5), + "indexFetches": uint64(0), + }, }, }, }, @@ -88,31 +90,33 @@ func TestExecuteExplainRequestSumOfRelatedOneToManyField(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "executionSuccess": true, - "sizeOfResult": 2, - "planExecutions": uint64(3), - "selectTopNode": dataMap{ - "sumNode": dataMap{ - "iterations": uint64(3), - "selectNode": dataMap{ - "iterations": uint64(3), - "filterMatches": uint64(2), - "typeIndexJoin": dataMap{ - "iterations": uint64(3), - "scanNode": dataMap{ - "iterations": uint64(3), - "docFetches": uint64(2), - "fieldFetches": uint64(2), - "indexFetches": uint64(0), - }, - "subTypeScanNode": dataMap{ - "iterations": uint64(5), - "docFetches": uint64(6), - "fieldFetches": uint64(9), - "indexFetches": uint64(0), + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "executionSuccess": true, + "sizeOfResult": 1, + "planExecutions": uint64(2), + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "sumNode": dataMap{ + "iterations": uint64(3), + "selectNode": dataMap{ + "iterations": uint64(3), + "filterMatches": uint64(2), + "typeIndexJoin": dataMap{ + "iterations": uint64(3), + "scanNode": dataMap{ + "iterations": uint64(3), + "docFetches": uint64(2), + "fieldFetches": uint64(2), + "indexFetches": uint64(0), + }, + "subTypeScanNode": dataMap{ + "iterations": uint64(5), + "docFetches": uint64(6), + "fieldFetches": uint64(9), + "indexFetches": uint64(0), + }, }, }, }, diff --git a/tests/integration/explain/simple/basic_test.go b/tests/integration/explain/simple/basic_test.go index d94deb01a9..04de88cd45 100644 --- a/tests/integration/explain/simple/basic_test.go +++ b/tests/integration/explain/simple/basic_test.go @@ -35,21 +35,23 @@ func TestSimpleExplainRequest(t *testing.T) { } }`, - ExpectedFullGraph: []dataMap{ - { - "explain": dataMap{ - "selectTopNode": dataMap{ - "selectNode": dataMap{ - "docIDs": nil, - "filter": nil, - "scanNode": dataMap{ - "filter": nil, - "collectionID": "3", - "collectionName": "Author", - "spans": []dataMap{ - { - "start": "/3", - "end": "/4", + ExpectedFullGraph: dataMap{ + "explain": dataMap{ + "operationNode": []dataMap{ + { + "selectTopNode": dataMap{ + "selectNode": dataMap{ + "docIDs": nil, + "filter": nil, + "scanNode": dataMap{ + "filter": nil, + "collectionID": "3", + "collectionName": "Author", + "spans": []dataMap{ + { + "start": "/3", + "end": "/4", + }, }, }, }, diff --git a/tests/integration/explain_result_asserter.go b/tests/integration/explain_result_asserter.go index 7d510bdc1a..e4c1e80988 100644 --- a/tests/integration/explain_result_asserter.go +++ b/tests/integration/explain_result_asserter.go @@ -55,9 +55,8 @@ func readNumberProp(t testing.TB, val any, prop string) uint64 { return 0 } -func (a *ExplainResultAsserter) Assert(t testing.TB, result []dataMap) { - require.Len(t, result, 1, "Expected len(result) = 1, got %d", len(result)) - explainNode, ok := result[0]["explain"].(dataMap) +func (a *ExplainResultAsserter) Assert(t testing.TB, result map[string]any) { + explainNode, ok := result["explain"].(dataMap) require.True(t, ok, "Expected explain none") assert.Equal(t, true, explainNode["executionSuccess"], "Expected executionSuccess property") if a.sizeOfResults.HasValue() { @@ -70,7 +69,9 @@ func (a *ExplainResultAsserter) Assert(t testing.TB, result []dataMap) { assert.Equal(t, a.planExecutions.Value(), actual, "Expected %d planExecutions, got %d", a.planExecutions.Value(), actual) } - selectTopNode, ok := explainNode["selectTopNode"].(dataMap) + operationNode := ConvertToArrayOfMaps(t, explainNode["operationNode"]) + require.Len(t, operationNode, 1) + selectTopNode, ok := operationNode[0]["selectTopNode"].(dataMap) require.True(t, ok, "Expected selectTopNode") selectNode, ok := selectTopNode["selectNode"].(dataMap) require.True(t, ok, "Expected selectNode") diff --git a/tests/integration/index/create_drop_test.go b/tests/integration/index/create_drop_test.go index a9e55f0322..17cd47df2a 100644 --- a/tests/integration/index/create_drop_test.go +++ b/tests/integration/index/create_drop_test.go @@ -49,10 +49,12 @@ func TestIndexDrop_ShouldNotHinderQuerying(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(21), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(21), + }, }, }, }, diff --git a/tests/integration/index/create_test.go b/tests/integration/index/create_test.go index 9afb8ea333..7b7242ca1a 100644 --- a/tests/integration/index/create_test.go +++ b/tests/integration/index/create_test.go @@ -46,10 +46,12 @@ func TestIndexCreateWithCollection_ShouldNotHinderQuerying(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "age": int64(21), + }, }, }, }, @@ -93,10 +95,12 @@ func TestIndexCreate_ShouldNotHinderQuerying(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(21), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(21), + }, }, }, }, diff --git a/tests/integration/index/create_unique_test.go b/tests/integration/index/create_unique_test.go index 36488ecaab..eb353ca70e 100644 --- a/tests/integration/index/create_unique_test.go +++ b/tests/integration/index/create_unique_test.go @@ -110,7 +110,9 @@ func TestUniqueIndexCreate_UponAddingDocWithExistingFieldValue_ReturnError(t *te name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, testUtils.GetIndexes{ CollectionID: 0, diff --git a/tests/integration/index/drop_test.go b/tests/integration/index/drop_test.go index 4639bfa756..a32f9706c7 100644 --- a/tests/integration/index/drop_test.go +++ b/tests/integration/index/drop_test.go @@ -50,10 +50,12 @@ func TestIndexDrop_IfIndexDoesNotExist_ReturnError(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(21), + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "age": int64(21), + }, }, }, }, diff --git a/tests/integration/index/index_p2p_test.go b/tests/integration/index/index_p2p_test.go index 820d6d2c5b..7be45dd61c 100644 --- a/tests/integration/index/index_p2p_test.go +++ b/tests/integration/index/index_p2p_test.go @@ -56,9 +56,11 @@ func TestIndexP2P_IfPeerCreatedDoc_ListeningPeerShouldIndexIt(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Fred", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + }, }, }, }, @@ -113,9 +115,11 @@ func TestIndexP2P_IfPeerUpdateDoc_ListeningPeerShouldUpdateIndex(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Islam", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Islam", + }, }, }, }, @@ -177,9 +181,11 @@ func TestIndexP2P_IfPeerDeleteDoc_ListeningPeerShouldDeleteIndex(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "age": int64(30), + Results: map[string]any{ + "Users": []map[string]any{ + { + "age": int64(30), + }, }, }, }, diff --git a/tests/integration/index/query_with_composite_index_field_order_test.go b/tests/integration/index/query_with_composite_index_field_order_test.go index 611bfed998..7b38163c1c 100644 --- a/tests/integration/index/query_with_composite_index_field_order_test.go +++ b/tests/integration/index/query_with_composite_index_field_order_test.go @@ -67,22 +67,24 @@ func TestQueryWithCompositeIndex_WithDefaultOrder_ShouldFetchInDefaultOrder(t *t age } }`, - Results: []map[string]any{ - { - "name": "Alan", - "age": 29, - }, - { - "name": "Alice", - "age": 22, - }, - { - "name": "Alice", - "age": 24, - }, - { - "name": "Alice", - "age": 38, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alan", + "age": 29, + }, + { + "name": "Alice", + "age": 22, + }, + { + "name": "Alice", + "age": 24, + }, + { + "name": "Alice", + "age": 38, + }, }, }, }, @@ -143,22 +145,24 @@ func TestQueryWithCompositeIndex_WithDefaultOrderCaseInsensitive_ShouldFetchInDe age } }`, - Results: []map[string]any{ - { - "name": "Alan", - "age": 29, - }, - { - "name": "Alice", - "age": 22, - }, - { - "name": "Alice", - "age": 24, - }, - { - "name": "Alice", - "age": 38, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alan", + "age": 29, + }, + { + "name": "Alice", + "age": 22, + }, + { + "name": "Alice", + "age": 24, + }, + { + "name": "Alice", + "age": 38, + }, }, }, }, @@ -227,26 +231,28 @@ func TestQueryWithCompositeIndex_WithRevertedOrderOnFirstField_ShouldFetchInReve age } }`, - Results: []map[string]any{ - { - "name": "Andy", - "age": 24, - }, - { - "name": "Alice", - "age": 22, - }, - { - "name": "Alice", - "age": 24, - }, - { - "name": "Alice", - "age": 38, - }, - { - "name": "Alan", - "age": 29, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Andy", + "age": 24, + }, + { + "name": "Alice", + "age": 22, + }, + { + "name": "Alice", + "age": 24, + }, + { + "name": "Alice", + "age": 38, + }, + { + "name": "Alan", + "age": 29, + }, }, }, }, @@ -315,26 +321,28 @@ func TestQueryWithCompositeIndex_WithRevertedOrderOnFirstFieldCaseInsensitive_Sh age } }`, - Results: []map[string]any{ - { - "name": "Andy", - "age": 24, - }, - { - "name": "Alice", - "age": 22, - }, - { - "name": "Alice", - "age": 24, - }, - { - "name": "Alice", - "age": 38, - }, - { - "name": "Alan", - "age": 29, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Andy", + "age": 24, + }, + { + "name": "Alice", + "age": 22, + }, + { + "name": "Alice", + "age": 24, + }, + { + "name": "Alice", + "age": 38, + }, + { + "name": "Alan", + "age": 29, + }, }, }, }, @@ -395,22 +403,24 @@ func TestQueryWithCompositeIndex_WithRevertedOrderOnSecondField_ShouldFetchInRev age } }`, - Results: []map[string]any{ - { - "name": "Alan", - "age": 29, - }, - { - "name": "Alice", - "age": 38, - }, - { - "name": "Alice", - "age": 24, - }, - { - "name": "Alice", - "age": 22, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alan", + "age": 29, + }, + { + "name": "Alice", + "age": 38, + }, + { + "name": "Alice", + "age": 24, + }, + { + "name": "Alice", + "age": 22, + }, }, }, }, @@ -473,22 +483,24 @@ func TestQueryWithCompositeIndex_WithRevertedOrderOnSecondFieldCaseInsensitive_S age } }`, - Results: []map[string]any{ - { - "name": "Alan", - "age": 29, - }, - { - "name": "Alice", - "age": 38, - }, - { - "name": "Alice", - "age": 24, - }, - { - "name": "Alice", - "age": 22, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alan", + "age": 29, + }, + { + "name": "Alice", + "age": 38, + }, + { + "name": "Alice", + "age": 24, + }, + { + "name": "Alice", + "age": 22, + }, }, }, }, @@ -541,10 +553,12 @@ func TestQueryWithCompositeIndex_IfExactMatchWithRevertedOrderOnFirstField_Shoul age } }`, - Results: []map[string]any{ - { - "name": "Alice", - "age": 22, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alice", + "age": 22, + }, }, }, }, @@ -597,10 +611,12 @@ func TestQueryWithCompositeIndex_IfExactMatchWithRevertedOrderOnSecondField_Shou age } }`, - Results: []map[string]any{ - { - "name": "Alice", - "age": 22, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alice", + "age": 22, + }, }, }, }, @@ -631,10 +647,12 @@ func TestQueryWithCompositeIndex_WithInFilterOnFirstFieldWithRevertedOrder_Shoul name } }`, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Fred"}, + }, }, }, }, @@ -664,10 +682,12 @@ func TestQueryWithCompositeIndex_WithInFilterOnSecondFieldWithRevertedOrder_Shou name } }`, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Andy"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Andy"}, + {"name": "Fred"}, + }, }, }, }, diff --git a/tests/integration/index/query_with_composite_index_only_filter_test.go b/tests/integration/index/query_with_composite_index_only_filter_test.go index ccb2a43e66..94e6a54727 100644 --- a/tests/integration/index/query_with_composite_index_only_filter_test.go +++ b/tests/integration/index/query_with_composite_index_only_filter_test.go @@ -51,8 +51,10 @@ func TestQueryWithCompositeIndex_WithEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Islam", "age": 32}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam", "age": 32}, + }, }, }, testUtils.Request{ @@ -61,8 +63,10 @@ func TestQueryWithCompositeIndex_WithEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Islam", "age": 32}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam", "age": 32}, + }, }, }, testUtils.Request{ @@ -71,7 +75,9 @@ func TestQueryWithCompositeIndex_WithEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req3, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } @@ -101,8 +107,10 @@ func TestQueryWithCompositeIndex_WithGreaterThanFilterOnFirstField_ShouldFetch(t }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -137,8 +145,10 @@ func TestQueryWithCompositeIndex_WithGreaterThanFilterOnSecondField_ShouldFetch( }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -173,9 +183,11 @@ func TestQueryWithCompositeIndex_WithGreaterOrEqualFilterOnFirstField_ShouldFetc }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Roy"}, - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Roy"}, + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -210,9 +222,11 @@ func TestQueryWithCompositeIndex_WithGreaterOrEqualFilterOnSecondField_ShouldFet }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -247,8 +261,10 @@ func TestQueryWithCompositeIndex_WithLessThanFilterOnFirstField_ShouldFetch(t *t }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + }, }, }, testUtils.Request{ @@ -283,8 +299,10 @@ func TestQueryWithCompositeIndex_WithLessThanFilterOnSecondField_ShouldFetch(t * }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + }, }, }, testUtils.Request{ @@ -319,9 +337,11 @@ func TestQueryWithCompositeIndex_WithLessOrEqualFilterOnFirstField_ShouldFetch(t }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -356,9 +376,11 @@ func TestQueryWithCompositeIndex_WithLessOrEqualFilterOnSecondField_ShouldFetch( }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Fred"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -393,15 +415,17 @@ func TestQueryWithCompositeIndex_WithNotEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Bruno"}, - {"name": "Chris"}, - {"name": "John"}, - {"name": "Keenan"}, - {"name": "Roy"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Bruno"}, + {"name": "Chris"}, + {"name": "John"}, + {"name": "Keenan"}, + {"name": "Roy"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -436,9 +460,11 @@ func TestQueryWithCompositeIndex_WithInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Andy"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Andy"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -473,10 +499,12 @@ func TestQueryWithCompositeIndex_WithNotInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -540,8 +568,10 @@ func TestQueryWithCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -550,8 +580,10 @@ func TestQueryWithCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -560,8 +592,10 @@ func TestQueryWithCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req3, - Results: []map[string]any{ - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -570,8 +604,10 @@ func TestQueryWithCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req4, - Results: []map[string]any{ - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -580,8 +616,10 @@ func TestQueryWithCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req5, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -590,11 +628,15 @@ func TestQueryWithCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req6, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, testUtils.Request{ Request: req7, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } @@ -623,11 +665,13 @@ func TestQueryWithCompositeIndex_WithNotLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -704,8 +748,10 @@ func TestQueryWithCompositeIndex_WithEqualFilterOnNilValueOnFirst_ShouldFetch(t age } }`, - Results: []map[string]any{ - {"name": nil, "age": 32}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": nil, "age": 32}, + }, }, }, }, @@ -756,10 +802,12 @@ func TestQueryWithCompositeIndex_WithEqualFilterOnNilValueOnSecond_ShouldFetch(t age } }`, - Results: []map[string]any{ - { - "name": "Alice", - "age": nil, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alice", + "age": nil, + }, }, }, }, @@ -815,9 +863,11 @@ func TestQueryWithCompositeIndex_IfMiddleFieldIsNotInFilter_ShouldIgnoreValue(t name } }`, - Results: []map[string]any{ - { - "name": "Alan", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alan", + }, }, }, }, @@ -907,11 +957,13 @@ func TestQueryWithCompositeIndex_IfConsecutiveEqOps_ShouldUseAllToOptimizeQuery( }, testUtils.Request{ Request: reqWithName, - Results: []map[string]any{ - {"about": "bob3"}, - {"about": "bob2"}, - {"about": "bob1"}, - {"about": "bob4"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob3"}, + {"about": "bob2"}, + {"about": "bob1"}, + {"about": "bob4"}, + }, }, }, testUtils.Request{ @@ -920,10 +972,12 @@ func TestQueryWithCompositeIndex_IfConsecutiveEqOps_ShouldUseAllToOptimizeQuery( }, testUtils.Request{ Request: reqWithNameAge, - Results: []map[string]any{ - {"about": "bob3"}, - {"about": "bob2"}, - {"about": "bob1"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob3"}, + {"about": "bob2"}, + {"about": "bob1"}, + }, }, }, testUtils.Request{ @@ -932,9 +986,11 @@ func TestQueryWithCompositeIndex_IfConsecutiveEqOps_ShouldUseAllToOptimizeQuery( }, testUtils.Request{ Request: reqWithNameAgeNumChildren, - Results: []map[string]any{ - {"about": "bob2"}, - {"about": "bob1"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob2"}, + {"about": "bob1"}, + }, }, }, testUtils.Request{ diff --git a/tests/integration/index/query_with_compound_filter_relation_test.go b/tests/integration/index/query_with_compound_filter_relation_test.go index 8f74411536..4708bb2c2a 100644 --- a/tests/integration/index/query_with_compound_filter_relation_test.go +++ b/tests/integration/index/query_with_compound_filter_relation_test.go @@ -43,7 +43,9 @@ func TestIndex_QueryWithIndexOnOneToManyRelationAndFilter_NoData(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Program": []map[string]any{}, + }, }, }, } @@ -78,7 +80,9 @@ func TestIndex_QueryWithIndexOnOneToManyRelationOrFilter_NoData(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Program": []map[string]any{}, + }, }, }, } @@ -113,7 +117,9 @@ func TestIndex_QueryWithIndexOnOneToManyRelationNotFilter_NoData(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Program": []map[string]any{}, + }, }, }, } @@ -187,12 +193,14 @@ func TestIndex_QueryWithIndexOnOneToManyRelationAndFilter_Data(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "LensVM", - }, - { - "name": "DefraDB", + Results: map[string]any{ + "Program": []map[string]any{ + { + "name": "LensVM", + }, + { + "name": "DefraDB", + }, }, }, }, @@ -269,15 +277,17 @@ func TestIndex_QueryWithIndexOnOneToManyRelationOrFilter_Data(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Zanzi", - }, - { - "name": "LensVM", - }, - { - "name": "DefraDB", + Results: map[string]any{ + "Program": []map[string]any{ + { + "name": "Zanzi", + }, + { + "name": "LensVM", + }, + { + "name": "DefraDB", + }, }, }, }, @@ -346,12 +356,14 @@ func TestIndex_QueryWithIndexOnOneToManyRelationNotFilter_Data(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Zanzi", - }, - { - "name": "Horizon", + Results: map[string]any{ + "Program": []map[string]any{ + { + "name": "Zanzi", + }, + { + "name": "Horizon", + }, }, }, }, diff --git a/tests/integration/index/query_with_index_combined_filter_test.go b/tests/integration/index/query_with_index_combined_filter_test.go index 595bf5fe44..0a6251db46 100644 --- a/tests/integration/index/query_with_index_combined_filter_test.go +++ b/tests/integration/index/query_with_index_combined_filter_test.go @@ -40,8 +40,10 @@ func TestQueryWithIndex_IfIndexFilterWithRegular_ShouldFilter(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -80,8 +82,10 @@ func TestQueryWithIndex_IfMultipleIndexFiltersWithRegular_ShouldFilter(t *testin }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Islam"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + }, }, }, testUtils.Request{ @@ -119,9 +123,11 @@ func TestQueryWithIndex_IfMultipleIndexFiltersWithRegularCaseInsensitive_ShouldF }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Andy"}, - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Andy"}, + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -157,8 +163,10 @@ func TestQueryWithIndex_FilterOnNonIndexedField_ShouldIgnoreIndex(t *testing.T) }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Roy"}, + }, }, }, testUtils.Request{ diff --git a/tests/integration/index/query_with_index_only_field_order_test.go b/tests/integration/index/query_with_index_only_field_order_test.go index 13a2f7cb77..6fdccf249a 100644 --- a/tests/integration/index/query_with_index_only_field_order_test.go +++ b/tests/integration/index/query_with_index_only_field_order_test.go @@ -56,16 +56,22 @@ func TestQueryWithIndex_IfIntFieldInDescOrder_ShouldFetchInRevertedOrder(t *test age } }`, - Results: []map[string]any{{ - "name": "Bob", - "age": 24, - }, { - "name": "Kate", - "age": 23, - }, { - "name": "Alice", - "age": 22, - }}, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Bob", + "age": 24, + }, + { + "name": "Kate", + "age": 23, + }, + { + "name": "Alice", + "age": 22, + }, + }, + }, }, }, } @@ -113,16 +119,22 @@ func TestQueryWithIndex_IfFloatFieldInDescOrder_ShouldFetchInRevertedOrder(t *te iq } }`, - Results: []map[string]any{{ - "name": "Bob", - "iq": 0.4, - }, { - "name": "Kate", - "iq": 0.3, - }, { - "name": "Alice", - "iq": 0.2, - }}, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Bob", + "iq": 0.4, + }, + { + "name": "Kate", + "iq": 0.3, + }, + { + "name": "Alice", + "iq": 0.2, + }, + }, + }, }, }, } @@ -165,13 +177,19 @@ func TestQueryWithIndex_IfStringFieldInDescOrder_ShouldFetchInRevertedOrder(t *t name } }`, - Results: []map[string]any{{ - "name": "Andy", - }, { - "name": "Alice", - }, { - "name": "Aaron", - }}, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Andy", + }, + { + "name": "Alice", + }, + { + "name": "Aaron", + }, + }, + }, }, }, } diff --git a/tests/integration/index/query_with_index_only_filter_test.go b/tests/integration/index/query_with_index_only_filter_test.go index 1baf7248ac..1800b855aa 100644 --- a/tests/integration/index/query_with_index_only_filter_test.go +++ b/tests/integration/index/query_with_index_only_filter_test.go @@ -38,10 +38,14 @@ func TestQueryWithIndex_WithNonIndexedFields_ShouldFetchAllOfThem(t *testing.T) }, testUtils.Request{ Request: req, - Results: []map[string]any{{ - "name": "Islam", - "age": int64(32), - }}, + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Islam", + "age": int64(32), + }, + }, + }, }, testUtils.Request{ Request: makeExplainQuery(req), @@ -73,8 +77,10 @@ func TestQueryWithIndex_WithEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Islam"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + }, }, }, testUtils.Request{ @@ -115,9 +121,11 @@ func TestQueryWithIndex_IfSeveralDocsWithEqFilter_ShouldFetchAll(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"age": int64(32)}, - {"age": int64(18)}, + Results: map[string]any{ + "User": []map[string]any{ + {"age": int64(32)}, + {"age": int64(18)}, + }, }, }, testUtils.Request{ @@ -151,8 +159,10 @@ func TestQueryWithIndex_WithGreaterThanFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -186,9 +196,11 @@ func TestQueryWithIndex_WithGreaterOrEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Keenan"}, - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Keenan"}, + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -222,8 +234,10 @@ func TestQueryWithIndex_WithLessThanFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -257,9 +271,11 @@ func TestQueryWithIndex_WithLessOrEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Bruno"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Bruno"}, + }, }, }, testUtils.Request{ @@ -293,16 +309,18 @@ func TestQueryWithIndex_WithNotEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Bruno"}, - {"name": "Chris"}, - {"name": "Fred"}, - {"name": "John"}, - {"name": "Keenan"}, - {"name": "Roy"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Bruno"}, + {"name": "Chris"}, + {"name": "Fred"}, + {"name": "John"}, + {"name": "Keenan"}, + {"name": "Roy"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -336,9 +354,11 @@ func TestQueryWithIndex_WithInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -393,9 +413,11 @@ func TestQueryWithIndex_WithInFilterOnFloat_ShouldFetch(t *testing.T) { name } }`, - Results: []map[string]any{ - {"name": "Islam"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + {"name": "Fred"}, + }, }, }, }, @@ -432,9 +454,11 @@ func TestQueryWithIndex_IfSeveralDocsWithInFilter_ShouldFetchAll(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"age": int64(32)}, - {"age": int64(18)}, + Results: map[string]any{ + "User": []map[string]any{ + {"age": int64(32)}, + {"age": int64(18)}, + }, }, }, testUtils.Request{ @@ -468,11 +492,13 @@ func TestQueryWithIndex_WithNotInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "John"}, - {"name": "Islam"}, - {"name": "Roy"}, - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "John"}, + {"name": "Islam"}, + {"name": "Roy"}, + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -531,9 +557,11 @@ func TestQueryWithIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -542,9 +570,11 @@ func TestQueryWithIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Fred"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -553,9 +583,11 @@ func TestQueryWithIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req3, - Results: []map[string]any{ - {"name": "Fred"}, - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -564,8 +596,10 @@ func TestQueryWithIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req4, - Results: []map[string]any{ - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -574,9 +608,11 @@ func TestQueryWithIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req5, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -585,7 +621,9 @@ func TestQueryWithIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req6, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, testUtils.Request{ Request: makeExplainQuery(req6), @@ -618,14 +656,16 @@ func TestQueryWithIndex_WithNotLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Bruno"}, - {"name": "Fred"}, - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Bruno"}, + {"name": "Fred"}, + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ diff --git a/tests/integration/index/query_with_relation_filter_test.go b/tests/integration/index/query_with_relation_filter_test.go index a7f13788dd..10492a99aa 100644 --- a/tests/integration/index/query_with_relation_filter_test.go +++ b/tests/integration/index/query_with_relation_filter_test.go @@ -54,10 +54,12 @@ func TestQueryWithIndexOnOneToManyRelation_IfFilterOnIndexedRelation_ShouldFilte }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Islam"}, - {"name": "Shahzad"}, - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + {"name": "Shahzad"}, + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -66,8 +68,10 @@ func TestQueryWithIndexOnOneToManyRelation_IfFilterOnIndexedRelation_ShouldFilte }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -118,10 +122,12 @@ func TestQueryWithIndexOnOneToManyRelation_IfFilterOnIndexedRelation_ShouldFilte }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Islam"}, - {"name": "Shahzad"}, - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + {"name": "Shahzad"}, + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -130,8 +136,10 @@ func TestQueryWithIndexOnOneToManyRelation_IfFilterOnIndexedRelation_ShouldFilte }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -182,8 +190,10 @@ func TestQueryWithIndexOnOneToOnesSecondaryRelation_IfFilterOnIndexedRelation_Sh }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Islam"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + }, }, }, testUtils.Request{ @@ -192,10 +202,12 @@ func TestQueryWithIndexOnOneToOnesSecondaryRelation_IfFilterOnIndexedRelation_Sh }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "John"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "John"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -247,8 +259,10 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedFieldOfRelatio }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -260,10 +274,12 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedFieldOfRelatio }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "John"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "John"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -318,8 +334,10 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedFieldOfRelatio }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -331,10 +349,12 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedFieldOfRelatio }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "John"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "John"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -381,8 +401,10 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedRelationWhileI }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -461,22 +483,24 @@ func TestQueryWithIndexOnOneToMany_IfFilterOnIndexedRelation_ShouldFilter(t *tes } } }`, - Results: []map[string]any{ - { - "name": "Chris", - "devices": []map[string]any{ - { - "model": "Walkman", - "manufacturer": "The Proclaimers", - }, - { - "model": "Walkman", - "manufacturer": "Sony", - }, - // The filter is on User, so all devices belonging to it will be returned - { - "model": "Running Man", - "manufacturer": "Braveworld Productions", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Chris", + "devices": []map[string]any{ + { + "model": "Walkman", + "manufacturer": "The Proclaimers", + }, + { + "model": "Walkman", + "manufacturer": "Sony", + }, + // The filter is on User, so all devices belonging to it will be returned + { + "model": "Running Man", + "manufacturer": "Braveworld Productions", + }, }, }, }, @@ -549,21 +573,23 @@ func TestQueryWithIndexOnOneToMany_IfFilterOnIndexedRelation_ShouldFilterWithExp }, testUtils.Request{ Request: req, - Results: []map[string]any{ - { - "name": "Chris", - "devices": []map[string]any{ - { - "model": "Walkman", - "manufacturer": "The Proclaimers", - }, - { - "model": "Walkman", - "manufacturer": "Sony", - }, - { - "model": "Running Man", - "manufacturer": "Braveworld Productions", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Chris", + "devices": []map[string]any{ + { + "model": "Walkman", + "manufacturer": "The Proclaimers", + }, + { + "model": "Walkman", + "manufacturer": "Sony", + }, + { + "model": "Running Man", + "manufacturer": "Braveworld Productions", + }, }, }, }, @@ -612,11 +638,13 @@ func TestQueryWithIndexOnOneToOne_IfFilterOnIndexedRelation_ShouldFilter(t *test }, testUtils.Request{ Request: req, - Results: []map[string]any{ - { - "name": "Islam", - "address": map[string]any{ - "city": "Munich", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Islam", + "address": map[string]any{ + "city": "Munich", + }, }, }, }, @@ -666,23 +694,25 @@ func TestQueryWithIndexOnManyToOne_IfFilterOnIndexedField_ShouldFilterWithExplai }, testUtils.Request{ Request: req, - Results: []map[string]any{ - { - "model": "Playstation 5", - "owner": map[string]any{ - "name": "Addo", + Results: map[string]any{ + "Device": []map[string]any{ + { + "model": "Playstation 5", + "owner": map[string]any{ + "name": "Addo", + }, }, - }, - { - "model": "iPhone 10", - "owner": map[string]any{ - "name": "Addo", + { + "model": "iPhone 10", + "owner": map[string]any{ + "name": "Addo", + }, }, - }, - { - "model": "Playstation 5", - "owner": map[string]any{ - "name": "Islam", + { + "model": "Playstation 5", + "owner": map[string]any{ + "name": "Islam", + }, }, }, }, @@ -731,10 +761,12 @@ func TestQueryWithIndexOnManyToOne_IfFilterOnIndexedRelation_ShouldFilterWithExp }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"model": "MacBook Pro"}, - {"model": "iPad Mini"}, - {"model": "iPhone 13"}, + Results: map[string]any{ + "Device": []map[string]any{ + {"model": "MacBook Pro"}, + {"model": "iPad Mini"}, + {"model": "iPhone 13"}, + }, }, }, testUtils.Request{ @@ -813,9 +845,11 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_NeNilFilterShouldUseIn }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"model": "Walkman"}, - {"model": "iPhone"}, + Results: map[string]any{ + "Device": []map[string]any{ + {"model": "Walkman"}, + {"model": "iPhone"}, + }, }, }, testUtils.Request{ @@ -894,9 +928,11 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_EqNilFilterShouldUseIn }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"model": "PlayStation 5"}, - {"model": "Running Man"}, + Results: map[string]any{ + "Device": []map[string]any{ + {"model": "PlayStation 5"}, + {"model": "Running Man"}, + }, }, }, testUtils.Request{ @@ -963,12 +999,14 @@ func TestQueryWithIndexOnManyToOne_MultipleViaOneToMany(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "devices": []map[string]any{ - { - "owner_id": testUtils.NewDocIndex(0, 0), - "manufacturer_id": testUtils.NewDocIndex(2, 0), + Results: map[string]any{ + "User": []map[string]any{ + { + "devices": []map[string]any{ + { + "owner_id": testUtils.NewDocIndex(0, 0), + "manufacturer_id": testUtils.NewDocIndex(2, 0), + }, }, }, }, diff --git a/tests/integration/index/query_with_unique_composite_index_filter_test.go b/tests/integration/index/query_with_unique_composite_index_filter_test.go index 26f35a0165..0df9b349ca 100644 --- a/tests/integration/index/query_with_unique_composite_index_filter_test.go +++ b/tests/integration/index/query_with_unique_composite_index_filter_test.go @@ -67,10 +67,12 @@ func TestQueryWithUniqueCompositeIndex_WithEqualFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Islam", "age": 32}, - {"name": "Islam", "age": 40}, - {"name": "Islam", "age": 50}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam", "age": 32}, + {"name": "Islam", "age": 40}, + {"name": "Islam", "age": 50}, + }, }, }, testUtils.Request{ @@ -79,8 +81,10 @@ func TestQueryWithUniqueCompositeIndex_WithEqualFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Islam", "age": 32}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam", "age": 32}, + }, }, }, testUtils.Request{ @@ -89,7 +93,9 @@ func TestQueryWithUniqueCompositeIndex_WithEqualFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req3, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } @@ -119,8 +125,10 @@ func TestQueryWithUniqueCompositeIndex_WithGreaterThanFilterOnFirstField_ShouldF }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -155,8 +163,10 @@ func TestQueryWithUniqueCompositeIndex_WithGreaterThanFilterOnSecondField_Should }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -191,9 +201,11 @@ func TestQueryWithUniqueCompositeIndex_WithGreaterOrEqualFilterOnFirstField_Shou }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Roy"}, - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Roy"}, + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -228,9 +240,11 @@ func TestQueryWithUniqueCompositeIndex_WithGreaterOrEqualFilterOnSecondField_Sho }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -265,8 +279,10 @@ func TestQueryWithUniqueCompositeIndex_WithLessThanFilterOnFirstField_ShouldFetc }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + }, }, }, testUtils.Request{ @@ -301,8 +317,10 @@ func TestQueryWithUniqueCompositeIndex_WithLessThanFilterOnSecondField_ShouldFet }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + }, }, }, testUtils.Request{ @@ -337,9 +355,11 @@ func TestQueryWithUniqueCompositeIndex_WithLessOrEqualFilterOnFirstField_ShouldF }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -374,9 +394,11 @@ func TestQueryWithUniqueCompositeIndex_WithLessOrEqualFilterOnSecondField_Should }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Fred"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -411,15 +433,17 @@ func TestQueryWithUniqueCompositeIndex_WithNotEqualFilter_ShouldFetch(t *testing }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Bruno"}, - {"name": "Chris"}, - {"name": "John"}, - {"name": "Keenan"}, - {"name": "Roy"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Bruno"}, + {"name": "Chris"}, + {"name": "John"}, + {"name": "Keenan"}, + {"name": "Roy"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -492,9 +516,11 @@ func TestQueryWithUniqueCompositeIndex_WithInForFirstAndEqForRest_ShouldFetchEff }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo", "age": 33}, - {"name": "Andy", "age": 33}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo", "age": 33}, + {"name": "Andy", "age": 33}, + }, }, }, testUtils.Request{ @@ -545,9 +571,11 @@ func TestQueryWithUniqueCompositeIndex_WithInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Andy"}, - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Andy"}, + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -582,10 +610,12 @@ func TestQueryWithUniqueCompositeIndex_WithNotInFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -649,8 +679,10 @@ func TestQueryWithUniqueCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -659,8 +691,10 @@ func TestQueryWithUniqueCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -669,8 +703,10 @@ func TestQueryWithUniqueCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req3, - Results: []map[string]any{ - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -679,8 +715,10 @@ func TestQueryWithUniqueCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req4, - Results: []map[string]any{ - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -689,8 +727,10 @@ func TestQueryWithUniqueCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req5, - Results: []map[string]any{ - {"name": "Addo"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + }, }, }, testUtils.Request{ @@ -699,11 +739,15 @@ func TestQueryWithUniqueCompositeIndex_WithLikeFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req6, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, testUtils.Request{ Request: req7, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } @@ -732,11 +776,13 @@ func TestQueryWithUniqueCompositeIndex_WithNotLikeFilter_ShouldFetch(t *testing. }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -770,12 +816,14 @@ func TestQueryWithUniqueCompositeIndex_WithNotCaseInsensitiveLikeFilter_ShouldFe }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, - {"name": "Chris"}, - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + {"name": "Chris"}, + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -852,8 +900,10 @@ func TestQueryWithUniqueCompositeIndex_WithEqualFilterOnNilValueOnFirst_ShouldFe age } }`, - Results: []map[string]any{ - {"name": nil, "age": 32}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": nil, "age": 32}, + }, }, }, }, @@ -908,9 +958,11 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnFirstFieldAndNilFilter_S }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": nil, "age": 32, "email": "bob@gmail.com"}, - {"name": nil, "age": 32, "email": "cate@gmail.com"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": nil, "age": 32, "email": "bob@gmail.com"}, + {"name": nil, "age": 32, "email": "cate@gmail.com"}, + }, }, }, testUtils.Request{ @@ -968,10 +1020,12 @@ func TestQueryWithUniqueCompositeIndex_WithEqualFilterOnNilValueOnSecond_ShouldF about } }`, - Results: []map[string]any{ - { - "age": nil, - "about": "alice_nil", + Results: map[string]any{ + "User": []map[string]any{ + { + "age": nil, + "about": "alice_nil", + }, }, }, }, @@ -1036,9 +1090,11 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnSecondFieldsAndNilFilter }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bob", "age": nil, "email": "bob1@gmail.com"}, - {"name": "Bob", "age": nil, "email": "bob2@gmail.com"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bob", "age": nil, "email": "bob1@gmail.com"}, + {"name": "Bob", "age": nil, "email": "bob2@gmail.com"}, + }, }, }, testUtils.Request{ @@ -1109,9 +1165,11 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnBothFieldsAndNilFilter_S about } }`, - Results: []map[string]any{ - {"about": "nil_nil_2"}, - {"about": "nil_nil_1"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "nil_nil_2"}, + {"about": "nil_nil_1"}, + }, }, }, testUtils.Request{ @@ -1121,10 +1179,12 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnBothFieldsAndNilFilter_S about } }`, - Results: []map[string]any{ - {"about": "nil_nil_2"}, - {"about": "nil_nil_1"}, - {"about": "nil_22"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "nil_nil_2"}, + {"about": "nil_nil_1"}, + {"about": "nil_22"}, + }, }, }, testUtils.Request{ @@ -1134,10 +1194,12 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnBothFieldsAndNilFilter_S about } }`, - Results: []map[string]any{ - {"about": "bob_nil"}, - {"about": "nil_nil_2"}, - {"about": "nil_nil_1"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob_nil"}, + {"about": "nil_nil_2"}, + {"about": "nil_nil_1"}, + }, }, }, }, @@ -1245,8 +1307,10 @@ func TestQueryWithUniqueCompositeIndex_AfterUpdateOnNilFields_ShouldFetch(t *tes about } }`, - Results: []map[string]any{ - {"about": "bob_nil -> nil_nil"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob_nil -> nil_nil"}, + }, }, }, testUtils.Request{ @@ -1256,9 +1320,11 @@ func TestQueryWithUniqueCompositeIndex_AfterUpdateOnNilFields_ShouldFetch(t *tes about } }`, - Results: []map[string]any{ - {"about": "bob_nil -> nil_nil"}, - {"about": "nil_nil -> nil_22"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob_nil -> nil_nil"}, + {"about": "nil_nil -> nil_22"}, + }, }, }, testUtils.Request{ @@ -1268,11 +1334,13 @@ func TestQueryWithUniqueCompositeIndex_AfterUpdateOnNilFields_ShouldFetch(t *tes about } }`, - Results: []map[string]any{ - {"about": "bob_22 -> bob_nil"}, - {"about": "nil_22 -> bob_nil"}, - {"about": "bob_nil -> nil_nil"}, - {"about": "nil_nil -> bob_nil"}, + Results: map[string]any{ + "User": []map[string]any{ + {"about": "bob_22 -> bob_nil"}, + {"about": "nil_22 -> bob_nil"}, + {"about": "bob_nil -> nil_nil"}, + {"about": "nil_nil -> bob_nil"}, + }, }, }, }, @@ -1327,9 +1395,11 @@ func TestQueryWithUniqueCompositeIndex_IfMiddleFieldIsNotInFilter_ShouldIgnoreVa name } }`, - Results: []map[string]any{ - { - "name": "Alan", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Alan", + }, }, }, }, diff --git a/tests/integration/index/query_with_unique_index_only_filter_test.go b/tests/integration/index/query_with_unique_index_only_filter_test.go index f21de4630c..50bb86712d 100644 --- a/tests/integration/index/query_with_unique_index_only_filter_test.go +++ b/tests/integration/index/query_with_unique_index_only_filter_test.go @@ -36,8 +36,10 @@ func TestQueryWithUniqueIndex_WithEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Islam"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Islam"}, + }, }, }, testUtils.Request{ @@ -71,8 +73,10 @@ func TestQueryWithUniqueIndex_WithGreaterThanFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -106,9 +110,11 @@ func TestQueryWithUniqueIndex_WithGreaterOrEqualFilter_ShouldFetch(t *testing.T) }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Keenan"}, - {"name": "Chris"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Keenan"}, + {"name": "Chris"}, + }, }, }, testUtils.Request{ @@ -142,8 +148,10 @@ func TestQueryWithUniqueIndex_WithLessThanFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -177,9 +185,11 @@ func TestQueryWithUniqueIndex_WithLessOrEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Bruno"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Bruno"}, + }, }, }, testUtils.Request{ @@ -213,16 +223,18 @@ func TestQueryWithUniqueIndex_WithNotEqualFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Bruno"}, - {"name": "Chris"}, - {"name": "Fred"}, - {"name": "John"}, - {"name": "Keenan"}, - {"name": "Roy"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Bruno"}, + {"name": "Chris"}, + {"name": "Fred"}, + {"name": "John"}, + {"name": "Keenan"}, + {"name": "Roy"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -256,9 +268,11 @@ func TestQueryWithUniqueIndex_WithInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Shahzad"}, - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Shahzad"}, + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -292,11 +306,13 @@ func TestQueryWithUniqueIndex_WithNotInFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "John"}, - {"name": "Islam"}, - {"name": "Roy"}, - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "John"}, + {"name": "Islam"}, + {"name": "Roy"}, + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -355,9 +371,11 @@ func TestQueryWithUniqueIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req1, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -366,9 +384,11 @@ func TestQueryWithUniqueIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req2, - Results: []map[string]any{ - {"name": "Fred"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -377,9 +397,11 @@ func TestQueryWithUniqueIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req3, - Results: []map[string]any{ - {"name": "Fred"}, - {"name": "Keenan"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + {"name": "Keenan"}, + }, }, }, testUtils.Request{ @@ -388,8 +410,10 @@ func TestQueryWithUniqueIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req4, - Results: []map[string]any{ - {"name": "Fred"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Fred"}, + }, }, }, testUtils.Request{ @@ -398,9 +422,11 @@ func TestQueryWithUniqueIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req5, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + }, }, }, testUtils.Request{ @@ -409,7 +435,9 @@ func TestQueryWithUniqueIndex_WithLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req6, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, testUtils.Request{ Request: makeExplainQuery(req6), @@ -442,14 +470,16 @@ func TestQueryWithUniqueIndex_WithNotLikeFilter_ShouldFetch(t *testing.T) { }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Addo"}, - {"name": "Andy"}, - {"name": "Bruno"}, - {"name": "Fred"}, - {"name": "Islam"}, - {"name": "Keenan"}, - {"name": "Roy"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Addo"}, + {"name": "Andy"}, + {"name": "Bruno"}, + {"name": "Fred"}, + {"name": "Islam"}, + {"name": "Keenan"}, + {"name": "Roy"}, + }, }, }, testUtils.Request{ @@ -483,15 +513,17 @@ func TestQueryWithUniqueIndex_WithNotCaseInsensitiveLikeFilter_ShouldFetch(t *te }, testUtils.Request{ Request: req, - Results: []map[string]any{ - {"name": "Bruno"}, - {"name": "Chris"}, - {"name": "Fred"}, - {"name": "Islam"}, - {"name": "John"}, - {"name": "Keenan"}, - {"name": "Roy"}, - {"name": "Shahzad"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bruno"}, + {"name": "Chris"}, + {"name": "Fred"}, + {"name": "Islam"}, + {"name": "John"}, + {"name": "Keenan"}, + {"name": "Roy"}, + {"name": "Shahzad"}, + }, }, }, testUtils.Request{ @@ -529,7 +561,9 @@ func TestQueryWithUniqueIndex_IfNoMatch_ReturnEmptyResult(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } @@ -573,8 +607,10 @@ func TestQueryWithUniqueIndex_WithEqualFilterOnNilValue_ShouldFetch(t *testing.T name } }`, - Results: []map[string]any{ - {"name": "Alice"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Alice"}, + }, }, }, }, @@ -624,8 +660,10 @@ func TestQueryWithUniqueIndex_WithEqualFilterOnZero_ShouldNotFetchNil(t *testing name } }`, - Results: []map[string]any{ - {"name": "Bob"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Bob"}, + }, }, }, }, @@ -675,9 +713,11 @@ func TestQueryWithUniqueIndex_WithNotEqualFilterOnNilValue_ShouldFetch(t *testin name } }`, - Results: []map[string]any{ - {"name": "Kate"}, - {"name": "Bob"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Kate"}, + {"name": "Bob"}, + }, }, }, }, @@ -726,9 +766,11 @@ func TestQueryWithUniqueIndex_WithMultipleNilValuesAndEqualFilter_ShouldFetch(t name } }`, - Results: []map[string]any{ - {"name": "Alice"}, - {"name": "Bob"}, + Results: map[string]any{ + "User": []map[string]any{ + {"name": "Alice"}, + {"name": "Bob"}, + }, }, }, }, diff --git a/tests/integration/issues/2566_test.go b/tests/integration/issues/2566_test.go index 696425a3b1..eecf0d20b4 100644 --- a/tests/integration/issues/2566_test.go +++ b/tests/integration/issues/2566_test.go @@ -83,11 +83,13 @@ func TestP2PUpdate_WithPNCounterSimultaneousOverflowIncrement_DoesNotReachConsit Age } }`, - Results: []map[string]any{ - { - // Node 0 overflows before subtraction, and because subtracting from infinity - // results in infinity the value remains infinate - "Age": math.Inf(1), + Results: map[string]any{ + "Users": []map[string]any{ + { + // Node 0 overflows before subtraction, and because subtracting from infinity + // results in infinity the value remains infinate + "Age": math.Inf(1), + }, }, }, }, @@ -98,11 +100,13 @@ func TestP2PUpdate_WithPNCounterSimultaneousOverflowIncrement_DoesNotReachConsit Age } }`, - Results: []map[string]any{ - { - // Node 1 subtracts before adding, meaning no overflow is achieved and the value - // remains finate - "Age": float64(1.7976931348623155e+307), + Results: map[string]any{ + "Users": []map[string]any{ + { + // Node 1 subtracts before adding, meaning no overflow is achieved and the value + // remains finate + "Age": float64(1.7976931348623155e+307), + }, }, }, }, @@ -175,11 +179,13 @@ func TestP2PUpdate_WithPNCounterSimultaneousOverflowDecrement_DoesNotReachConsit Age } }`, - Results: []map[string]any{ - { - // Node 0 overflows before addition, and because adding to infinity - // results in infinity the value remains infinate - "Age": math.Inf(-1), + Results: map[string]any{ + "Users": []map[string]any{ + { + // Node 0 overflows before addition, and because adding to infinity + // results in infinity the value remains infinate + "Age": math.Inf(-1), + }, }, }, }, @@ -190,11 +196,13 @@ func TestP2PUpdate_WithPNCounterSimultaneousOverflowDecrement_DoesNotReachConsit Age } }`, - Results: []map[string]any{ - { - // Node 1 adds before subtracting, meaning no overflow is achieved and the value - // remains finate - "Age": float64(-1.7976931348623155e+307), + Results: map[string]any{ + "Users": []map[string]any{ + { + // Node 1 adds before subtracting, meaning no overflow is achieved and the value + // remains finate + "Age": float64(-1.7976931348623155e+307), + }, }, }, }, diff --git a/tests/integration/mutation/create/crdt/pcounter_test.go b/tests/integration/mutation/create/crdt/pcounter_test.go index e54dba4ea6..724b157006 100644 --- a/tests/integration/mutation/create/crdt/pcounter_test.go +++ b/tests/integration/mutation/create/crdt/pcounter_test.go @@ -42,11 +42,13 @@ func TestPCounterCreate_IntKindWithPositiveValue_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "_docID": "bae-d8cb53d4-ac5a-5c55-8306-64df633d400d", - "name": "John", - "points": int64(10), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-d8cb53d4-ac5a-5c55-8306-64df633d400d", + "name": "John", + "points": int64(10), + }, }, }, }, diff --git a/tests/integration/mutation/create/crdt/pncounter_test.go b/tests/integration/mutation/create/crdt/pncounter_test.go index b8808ff40a..c16a0c5bb6 100644 --- a/tests/integration/mutation/create/crdt/pncounter_test.go +++ b/tests/integration/mutation/create/crdt/pncounter_test.go @@ -42,11 +42,13 @@ func TestPNCounterCreate_IntKindWithPositiveValue_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "_docID": "bae-bc5464e4-26a6-5307-b516-aada0abeb089", - "name": "John", - "points": int64(10), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-bc5464e4-26a6-5307-b516-aada0abeb089", + "name": "John", + "points": int64(10), + }, }, }, }, diff --git a/tests/integration/mutation/create/field_kinds/field_kind_json_test.go b/tests/integration/mutation/create/field_kinds/field_kind_json_test.go index 8833a74b31..cc97bd162f 100644 --- a/tests/integration/mutation/create/field_kinds/field_kind_json_test.go +++ b/tests/integration/mutation/create/field_kinds/field_kind_json_test.go @@ -36,11 +36,13 @@ func TestMutationCreate_WithJSONFieldGivenValidJSON_NoError(t *testing.T) { custom } }`, - Results: []map[string]any{ - { - "_docID": "bae-84ae4ef8-ca0c-5f32-bc85-cee97e731bc0", - "custom": "{\"tree\":\"maple\",\"age\":250}", - "name": "John", + Results: map[string]any{ + "create_Users": []map[string]any{ + { + "_docID": "bae-84ae4ef8-ca0c-5f32-bc85-cee97e731bc0", + "custom": "{\"tree\":\"maple\",\"age\":250}", + "name": "John", + }, }, }, }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go b/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go index 3bddea1a4a..6fedc0c8c2 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go @@ -82,9 +82,11 @@ func TestMutationCreateOneToMany_AliasedRelationNameNonExistingRelationManySide_ name } }`, - Results: []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -109,9 +111,11 @@ func TestMutationCreateOneToMany_AliasedRelationNameInvalidIDManySide_CreatedDoc name } }`, - Results: []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -146,12 +150,14 @@ func TestMutationCreateOneToMany_AliasedRelationNameToLinkFromManySide(t *testin } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -166,11 +172,13 @@ func TestMutationCreateOneToMany_AliasedRelationNameToLinkFromManySide(t *testin } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -207,9 +215,11 @@ func TestMutationUpdateOneToMany_AliasRelationNameAndInternalIDBothProduceSameDo _docID } }`, - Results: []map[string]any{ - { - "_docID": bookID, // Must be same as below. + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": bookID, // Must be same as below. + }, }, }, }, @@ -242,9 +252,11 @@ func TestMutationUpdateOneToMany_AliasRelationNameAndInternalIDBothProduceSameDo _docID } }`, - Results: []map[string]any{ - { - "_docID": bookID, // Must be same as below. + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": bookID, // Must be same as below. + }, }, }, }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go b/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go index 56efed2216..36884aa645 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go @@ -82,9 +82,11 @@ func TestMutationCreateOneToMany_NonExistingRelationManySide_CreatedDoc(t *testi name } }`, - Results: []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -119,12 +121,14 @@ func TestMutationCreateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -139,11 +143,13 @@ func TestMutationCreateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go b/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go index ef263bd47e..8c7dddb1c2 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go @@ -60,9 +60,11 @@ func TestMutationCreateOneToOne_UseAliasWithNonExistingRelationPrimarySide_Creat name } }`, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, }, @@ -114,11 +116,13 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromPrimarySid } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -132,11 +136,13 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromPrimarySid } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, @@ -173,11 +179,13 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromSecondaryS } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, @@ -191,11 +199,13 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromSecondaryS } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go b/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go index fa890f8e70..fabced3505 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go @@ -60,9 +60,11 @@ func TestMutationCreateOneToOneNoChild(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, }, @@ -115,11 +117,13 @@ func TestMutationCreateOneToOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -134,11 +138,13 @@ func TestMutationCreateOneToOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, @@ -176,11 +182,13 @@ func TestMutationCreateOneToOneSecondarySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, @@ -195,11 +203,13 @@ func TestMutationCreateOneToOneSecondarySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go b/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go index 3b40c19f6c..f626483375 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go @@ -46,9 +46,11 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + Results: map[string]any{ + "create_Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + }, }, }, }, @@ -59,9 +61,11 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + Results: map[string]any{ + "create_Book": []map[string]any{ + { + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + }, }, }, }, @@ -78,20 +82,22 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. } } }`, - Results: []map[string]any{ - { - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", - "published": map[string]any{ - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", - "name": "Book By Website", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + "published": map[string]any{ + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", + }, }, - }, - { - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", - "name": "Online", - "published": nil, + { + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + "name": "Online", + "published": nil, + }, }, }, }, @@ -108,18 +114,20 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. } } }`, - Results: []map[string]any{ - { - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", - "published": nil, - }, - { - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", - "name": "Online", - "published": map[string]any{ - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", - "name": "Book By Online", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + "published": nil, + }, + { + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + "name": "Online", + "published": map[string]any{ + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + "name": "Book By Online", + }, }, }, }, @@ -143,21 +151,23 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. } } }`, - Results: []map[string]any{ - { - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", - "name": "Book By Online", - "publisher": map[string]any{ - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", - "name": "Online", + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + "name": "Book By Online", + "publisher": map[string]any{ + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + "name": "Online", + }, }, - }, - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", - "name": "Book By Website", - "publisher": map[string]any{ - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", + "publisher": map[string]any{ + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + }, }, }, }, @@ -196,9 +206,11 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + Results: map[string]any{ + "create_Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + }, }, }, }, @@ -209,9 +221,11 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + Results: map[string]any{ + "create_Book": []map[string]any{ + { + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + }, }, }, }, @@ -228,13 +242,15 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing } } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", - "name": "Book By Website", - "publisher": map[string]any{ - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", + "publisher": map[string]any{ + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + }, }, }, }, @@ -252,13 +268,15 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing } } }`, - Results: []map[string]any{ - { - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", - "name": "Book By Online", - "publisher": map[string]any{ - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", - "name": "Online", + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + "name": "Book By Online", + "publisher": map[string]any{ + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + "name": "Online", + }, }, }, }, @@ -282,22 +300,24 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing } } }`, - Results: []map[string]any{ - { - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", - "published": map[string]any{ - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", - "name": "Book By Website", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + "published": map[string]any{ + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", + }, }, - }, - { - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", - "name": "Online", - "published": map[string]any{ - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", - "name": "Book By Online", + { + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + "name": "Online", + "published": map[string]any{ + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + "name": "Book By Online", + }, }, }, }, diff --git a/tests/integration/mutation/create/simple_create_many_test.go b/tests/integration/mutation/create/simple_create_many_test.go index 5f1e425549..94e013a61a 100644 --- a/tests/integration/mutation/create/simple_create_many_test.go +++ b/tests/integration/mutation/create/simple_create_many_test.go @@ -50,16 +50,18 @@ func TestMutationCreateMany(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_docID": "bae-48339725-ed14-55b1-8e63-3fda5f590725", - "name": "Islam", - "age": int64(33), - }, - { - "_docID": "bae-8c89a573-c287-5d8c-8ba6-c47c814c594d", - "name": "John", - "age": int64(27), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-48339725-ed14-55b1-8e63-3fda5f590725", + "name": "Islam", + "age": int64(33), + }, + { + "_docID": "bae-8c89a573-c287-5d8c-8ba6-c47c814c594d", + "name": "John", + "age": int64(27), + }, }, }, }, diff --git a/tests/integration/mutation/create/simple_test.go b/tests/integration/mutation/create/simple_test.go index 61280c0cc8..f8335dbe4c 100644 --- a/tests/integration/mutation/create/simple_test.go +++ b/tests/integration/mutation/create/simple_test.go @@ -51,7 +51,9 @@ func TestMutationCreate_GivenNonExistantField_Errors(t *testing.T) { } } `, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -87,11 +89,13 @@ func TestMutationCreate(t *testing.T) { } } `, - Results: []map[string]any{ - { - "_docID": "bae-8c89a573-c287-5d8c-8ba6-c47c814c594d", - "name": "John", - "age": int64(27), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-8c89a573-c287-5d8c-8ba6-c47c814c594d", + "name": "John", + "age": int64(27), + }, }, }, }, @@ -155,9 +159,11 @@ func TestMutationCreate_GivenEmptyInput(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-332de69b-47da-5175-863f-2480107f4884", + Results: map[string]any{ + "create_Users": []map[string]any{ + { + "_docID": "bae-332de69b-47da-5175-863f-2480107f4884", + }, }, }, }, diff --git a/tests/integration/mutation/create/with_version_test.go b/tests/integration/mutation/create/with_version_test.go index 4ade869073..b19db8ee4c 100644 --- a/tests/integration/mutation/create/with_version_test.go +++ b/tests/integration/mutation/create/with_version_test.go @@ -35,11 +35,13 @@ func TestMutationCreate_ReturnsVersionCID(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "_version": []map[string]any{ - { - "cid": "bafyreia5ph2hvwebdsxe7m2f6bwuq7ngwxzqp7esiuzjihtcz2jswma6xu", + Results: map[string]any{ + "create_Users": []map[string]any{ + { + "_version": []map[string]any{ + { + "cid": "bafyreia5ph2hvwebdsxe7m2f6bwuq7ngwxzqp7esiuzjihtcz2jswma6xu", + }, }, }, }, diff --git a/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go b/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go index 8b8e7088a6..de72ebf893 100644 --- a/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go +++ b/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go @@ -65,9 +65,11 @@ func TestDeletionOfADocumentUsingSingleDocIDWithShowDeletedDocumentQuery(t *test _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-b5c56d8f-b2f5-57f9-b371-4e9e04903e91", + Results: map[string]any{ + "delete_Book": []map[string]any{ + { + "_docID": "bae-b5c56d8f-b2f5-57f9-b371-4e9e04903e91", + }, }, }, }, @@ -84,21 +86,23 @@ func TestDeletionOfADocumentUsingSingleDocIDWithShowDeletedDocumentQuery(t *test } } }`, - Results: []map[string]any{ - { - "_deleted": false, - "name": "John", - "age": int64(30), - "published": []map[string]any{ - { - "_deleted": false, - "name": "John has a chamber of secrets", - "rating": 9.9, - }, - { - "_deleted": true, - "name": "John and the philosopher are stoned", - "rating": 9.9, + Results: map[string]any{ + "Author": []map[string]any{ + { + "_deleted": false, + "name": "John", + "age": int64(30), + "published": []map[string]any{ + { + "_deleted": false, + "name": "John has a chamber of secrets", + "rating": 9.9, + }, + { + "_deleted": true, + "name": "John and the philosopher are stoned", + "rating": 9.9, + }, }, }, }, diff --git a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go index 057f20a00b..fefcc350af 100644 --- a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go +++ b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go @@ -57,9 +57,11 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", + Results: map[string]any{ + "delete_Author": []map[string]any{ + { + "_docID": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", + }, }, }, }, @@ -105,9 +107,11 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { AliasOfKey: _docID } }`, - Results: []map[string]any{ - { - "AliasOfKey": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", + Results: map[string]any{ + "delete_Author": []map[string]any{ + { + "AliasOfKey": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", + }, }, }, }, @@ -170,9 +174,11 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { Key: _docID } }`, - Results: []map[string]any{ - { - "Key": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", + Results: map[string]any{ + "delete_Author": []map[string]any{ + { + "Key": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", + }, }, }, }, diff --git a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go index 9298f26198..d7be187d49 100644 --- a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go +++ b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go @@ -49,9 +49,11 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideForwardDirection(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + Results: map[string]any{ + "delete_Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + }, }, }, }, @@ -70,11 +72,13 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideForwardDirection(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", - "published": nil, + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + "published": nil, + }, }, }, }, @@ -115,9 +119,11 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideBackwardDirection(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + Results: map[string]any{ + "delete_Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + }, }, }, }, @@ -136,7 +142,9 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideBackwardDirection(t *testing.T) { } } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Book": []map[string]any{}, + }, }, }, } @@ -175,9 +183,11 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + Results: map[string]any{ + "delete_Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + }, }, }, }, @@ -194,13 +204,15 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes } } }`, - Results: []map[string]any{ - { - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", - "published": map[string]any{ - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", - "name": "Book By Website", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + "published": map[string]any{ + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", + }, }, }, }, @@ -220,11 +232,13 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes } } }`, - Results: []map[string]any{ - { - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", - "published": nil, + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + "published": nil, + }, }, }, }, @@ -265,9 +279,11 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnBackwardDirection(t *te _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + Results: map[string]any{ + "delete_Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + }, }, }, }, @@ -284,13 +300,15 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnBackwardDirection(t *te } } }`, - Results: []map[string]any{ - { - "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", - "name": "Book By Website", - "publisher": map[string]any{ - "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", - "name": "Website", + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", + "publisher": map[string]any{ + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", + }, }, }, }, @@ -310,7 +328,9 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnBackwardDirection(t *te } } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Book": []map[string]any{}, + }, }, }, } @@ -350,9 +370,11 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideForwardDirection(t *testing.T) _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + Results: map[string]any{ + "delete_Publisher": []map[string]any{ + { + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + }, }, }, }, @@ -371,7 +393,9 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideForwardDirection(t *testing.T) } } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Publisher": []map[string]any{}, + }, }, }, } @@ -411,9 +435,11 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideBackwardDirection(t *testing.T _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + Results: map[string]any{ + "delete_Publisher": []map[string]any{ + { + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + }, }, }, }, @@ -432,11 +458,13 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideBackwardDirection(t *testing.T } } }`, - Results: []map[string]any{ - { - "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", - "name": "Book By Online", - "publisher": nil, + Results: map[string]any{ + "Book": []map[string]any{ + { + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + "name": "Book By Online", + "publisher": nil, + }, }, }, }, diff --git a/tests/integration/mutation/delete/with_deleted_field_test.go b/tests/integration/mutation/delete/with_deleted_field_test.go index 274d224253..eb9903ed47 100644 --- a/tests/integration/mutation/delete/with_deleted_field_test.go +++ b/tests/integration/mutation/delete/with_deleted_field_test.go @@ -39,10 +39,12 @@ func TestMutationDeletion_WithDeletedField(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_deleted": true, - "_docID": "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_deleted": true, + "_docID": "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f", + }, }, }, }, diff --git a/tests/integration/mutation/delete/with_filter_test.go b/tests/integration/mutation/delete/with_filter_test.go index 1884d38e17..a54fb12f29 100644 --- a/tests/integration/mutation/delete/with_filter_test.go +++ b/tests/integration/mutation/delete/with_filter_test.go @@ -38,9 +38,11 @@ func TestMutationDeletion_WithFilter(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Shahzad", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "name": "Shahzad", + }, }, }, }, @@ -86,12 +88,14 @@ func TestMutationDeletion_WithFilterMatchingMultipleDocs(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "age": int64(2), - }, - { - "age": int64(1), + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "age": int64(2), + }, + { + "age": int64(1), + }, }, }, }, @@ -133,15 +137,17 @@ func TestMutationDeletion_WithEmptyFilter(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", - }, - { - "name": "Shahzad", - }, - { - "name": "Fred", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "name": "John", + }, + { + "name": "Shahzad", + }, + { + "name": "Fred", + }, }, }, }, @@ -173,7 +179,9 @@ func TestMutationDeletion_WithFilterNoMatch(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, }, } @@ -198,7 +206,9 @@ func TestMutationDeletion_WithFilterOnEmptyCollection(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/mutation/delete/with_id_alias_test.go b/tests/integration/mutation/delete/with_id_alias_test.go index c9d259ac8b..882125c933 100644 --- a/tests/integration/mutation/delete/with_id_alias_test.go +++ b/tests/integration/mutation/delete/with_id_alias_test.go @@ -38,9 +38,11 @@ func TestMutationDeletion_WithIDAndAlias(t *testing.T) { fancyKey: _docID } }`, - Results: []map[string]any{ - { - "fancyKey": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "fancyKey": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + }, }, }, }, diff --git a/tests/integration/mutation/delete/with_id_test.go b/tests/integration/mutation/delete/with_id_test.go index 774e9a8c18..6e6b8bb5b8 100644 --- a/tests/integration/mutation/delete/with_id_test.go +++ b/tests/integration/mutation/delete/with_id_test.go @@ -33,7 +33,9 @@ func TestMutationDeletion_WithIDUnknownValue(t *testing.T) { _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, }, } @@ -63,7 +65,9 @@ func TestMutationDeletion_WithIDUnknownValueAndUnrelatedRecordInCollection(t *te _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/mutation/delete/with_id_txn_test.go b/tests/integration/mutation/delete/with_id_txn_test.go index f704acea56..aa33ee447f 100644 --- a/tests/integration/mutation/delete/with_id_txn_test.go +++ b/tests/integration/mutation/delete/with_id_txn_test.go @@ -41,9 +41,11 @@ func TestMutationDeletion_WithIDAndTxn(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + }, }, }, }, @@ -54,7 +56,9 @@ func TestMutationDeletion_WithIDAndTxn(t *testing.T) { _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/mutation/delete/with_ids_alias_test.go b/tests/integration/mutation/delete/with_ids_alias_test.go index b815ec703d..23fa4e2dc4 100644 --- a/tests/integration/mutation/delete/with_ids_alias_test.go +++ b/tests/integration/mutation/delete/with_ids_alias_test.go @@ -52,12 +52,14 @@ func TestMutationDeletion_WithIDsAndSelectAlias(t *testing.T) { AliasID: _docID } }`, - Results: []map[string]any{ - { - "AliasID": "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0", - }, - { - "AliasID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "AliasID": "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0", + }, + { + "AliasID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", + }, }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_filter_test.go b/tests/integration/mutation/delete/with_ids_filter_test.go index 41f79fa859..94024a4113 100644 --- a/tests/integration/mutation/delete/with_ids_filter_test.go +++ b/tests/integration/mutation/delete/with_ids_filter_test.go @@ -38,9 +38,11 @@ func TestMutationDeletion_WithIDsAndEmptyFilter(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + }, }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_test.go b/tests/integration/mutation/delete/with_ids_test.go index 4f3e462b00..1469990ce7 100644 --- a/tests/integration/mutation/delete/with_ids_test.go +++ b/tests/integration/mutation/delete/with_ids_test.go @@ -43,12 +43,14 @@ func TestMutationDeletion_WithIDs(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f", - }, - { - "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_docID": "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f", + }, + { + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + }, }, }, }, @@ -85,7 +87,9 @@ func TestMutationDeletion_WithEmptyIDs(t *testing.T) { _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, testUtils.Request{ // Make sure no documents have been deleted @@ -94,12 +98,14 @@ func TestMutationDeletion_WithEmptyIDs(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", - }, - { - "name": "Shahzad", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + }, + { + "name": "Shahzad", + }, }, }, }, @@ -126,7 +132,9 @@ func TestMutationDeletion_WithIDsSingleUnknownID(t *testing.T) { _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, }, } @@ -151,7 +159,9 @@ func TestMutationDeletion_WithIDsMultipleUnknownID(t *testing.T) { _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, }, } @@ -181,9 +191,11 @@ func TestMutationDeletion_WithIDsKnownAndUnknown(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", + }, }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_txn_test.go b/tests/integration/mutation/delete/with_ids_txn_test.go index 53cb44c9e9..85c3624c7f 100644 --- a/tests/integration/mutation/delete/with_ids_txn_test.go +++ b/tests/integration/mutation/delete/with_ids_txn_test.go @@ -47,9 +47,11 @@ func TestMutationDeletion_WithIDsAndTxn(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_docID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", + }, }, }, }, @@ -60,7 +62,9 @@ func TestMutationDeletion_WithIDsAndTxn(t *testing.T) { _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/mutation/delete/with_ids_update_alias_test.go b/tests/integration/mutation/delete/with_ids_update_alias_test.go index 551b52a175..89ea5f8c06 100644 --- a/tests/integration/mutation/delete/with_ids_update_alias_test.go +++ b/tests/integration/mutation/delete/with_ids_update_alias_test.go @@ -60,12 +60,14 @@ func TestMutationDeletion_WithUpdateAndIDsAndSelectAlias(t *testing.T) { AliasID: _docID } }`, - Results: []map[string]any{ - { - "AliasID": "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0", - }, - { - "AliasID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "AliasID": "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0", + }, + { + "AliasID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", + }, }, }, }, diff --git a/tests/integration/mutation/mix/with_txn_test.go b/tests/integration/mutation/mix/with_txn_test.go index 5354b69eea..11ee66b73d 100644 --- a/tests/integration/mutation/mix/with_txn_test.go +++ b/tests/integration/mutation/mix/with_txn_test.go @@ -37,9 +37,11 @@ func TestMutationWithTxnDeletesUserGivenSameTransaction(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + }, }, }, }, @@ -50,9 +52,11 @@ func TestMutationWithTxnDeletesUserGivenSameTransaction(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + Results: map[string]any{ + "delete_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + }, }, }, }, @@ -81,9 +85,11 @@ func TestMutationWithTxnDoesNotDeletesUserGivenDifferentTransactions(t *testing. _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + }, }, }, }, @@ -94,7 +100,9 @@ func TestMutationWithTxnDoesNotDeletesUserGivenDifferentTransactions(t *testing. _docID } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "delete_User": []map[string]any{}, + }, }, testUtils.Request{ TransactionID: immutable.Some(0), @@ -105,11 +113,13 @@ func TestMutationWithTxnDoesNotDeletesUserGivenDifferentTransactions(t *testing. age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(27), + Results: map[string]any{ + "User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(27), + }, }, }, }, @@ -122,7 +132,9 @@ func TestMutationWithTxnDoesNotDeletesUserGivenDifferentTransactions(t *testing. age } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "User": []map[string]any{}, + }, }, }, } @@ -155,9 +167,11 @@ func TestMutationWithTxnDoesUpdateUserGivenSameTransactions(t *testing.T) { _docID } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + Results: map[string]any{ + "update_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + }, }, }, }, @@ -170,11 +184,13 @@ func TestMutationWithTxnDoesUpdateUserGivenSameTransactions(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(28), + Results: map[string]any{ + "User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(28), + }, }, }, }, @@ -211,11 +227,13 @@ func TestMutationWithTxnDoesNotUpdateUserGivenDifferentTransactions(t *testing.T age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(28), + Results: map[string]any{ + "update_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(28), + }, }, }, }, @@ -228,11 +246,13 @@ func TestMutationWithTxnDoesNotUpdateUserGivenDifferentTransactions(t *testing.T age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(27), + Results: map[string]any{ + "User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(27), + }, }, }, }, @@ -270,11 +290,13 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(28), + Results: map[string]any{ + "update_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(28), + }, }, }, }, @@ -287,11 +309,13 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(29), + Results: map[string]any{ + "update_User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(29), + }, }, }, }, @@ -311,11 +335,13 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) age } }`, - Results: []map[string]any{ - { - "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", - "name": "John", - "age": int64(28), + Results: map[string]any{ + "User": []map[string]any{ + { + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", + "name": "John", + "age": int64(28), + }, }, }, }, diff --git a/tests/integration/mutation/update/crdt/pcounter_test.go b/tests/integration/mutation/update/crdt/pcounter_test.go index c4ff85e8b4..784bf9f2c4 100644 --- a/tests/integration/mutation/update/crdt/pcounter_test.go +++ b/tests/integration/mutation/update/crdt/pcounter_test.go @@ -52,10 +52,12 @@ func TestPCounterUpdate_IntKindWithNegativeIncrement_ShouldError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(0), + }, }, }, }, @@ -102,10 +104,12 @@ func TestPCounterUpdate_IntKindWithPositiveIncrement_ShouldIncrement(t *testing. points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(20), + }, }, }, }, @@ -154,10 +158,12 @@ func TestPCounterUpdate_IntKindWithPositiveIncrementOverflow_RollsOverToMinInt64 points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(math.MinInt64), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(math.MinInt64), + }, }, }, }, @@ -204,11 +210,13 @@ func TestPCounterUpdate_FloatKindWithPositiveIncrement_ShouldIncrement(t *testin points } }`, - Results: []map[string]any{ - { - "name": "John", - // Note the lack of precision of float types. - "points": 20.299999999999997, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // Note the lack of precision of float types. + "points": 20.299999999999997, + }, }, }, }, @@ -251,10 +259,12 @@ func TestPCounterUpdate_FloatKindWithPositiveIncrementOverflow_NoOp(t *testing.T points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": math.MaxFloat64, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": math.MaxFloat64, + }, }, }, }, diff --git a/tests/integration/mutation/update/crdt/pncounter_test.go b/tests/integration/mutation/update/crdt/pncounter_test.go index 534bd406dc..11efc0452b 100644 --- a/tests/integration/mutation/update/crdt/pncounter_test.go +++ b/tests/integration/mutation/update/crdt/pncounter_test.go @@ -57,10 +57,12 @@ func TestPNCounterUpdate_IntKindWithPositiveIncrement_ShouldIncrement(t *testing points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(20), + }, }, }, }, @@ -109,10 +111,12 @@ func TestPNCounterUpdate_IntKindWithPositiveIncrementOverflow_RollsOverToMinInt6 points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(math.MinInt64), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(math.MinInt64), + }, }, }, }, @@ -159,11 +163,13 @@ func TestPNCounterUpdate_FloatKindWithPositiveIncrement_ShouldIncrement(t *testi points } }`, - Results: []map[string]any{ - { - "name": "John", - // Note the lack of precision of float types. - "points": 20.299999999999997, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // Note the lack of precision of float types. + "points": 20.299999999999997, + }, }, }, }, @@ -212,10 +218,12 @@ func TestPNCounterUpdate_FloatKindWithPositiveIncrementOverflow_PositiveInf(t *t points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": math.Inf(1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": math.Inf(1), + }, }, }, }, @@ -264,10 +272,12 @@ func TestPNCounterUpdate_FloatKindWithDecrementOverflow_NegativeInf(t *testing.T points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": math.Inf(-1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": math.Inf(-1), + }, }, }, }, @@ -309,10 +319,12 @@ func TestPNCounterUpdate_FloatKindWithPositiveIncrementInsignificantValue_DoesNo points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": math.MaxFloat64 / 10, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": math.MaxFloat64 / 10, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_bool_test.go b/tests/integration/mutation/update/field_kinds/array_bool_test.go index b1a5500242..4f121cbdd5 100644 --- a/tests/integration/mutation/update/field_kinds/array_bool_test.go +++ b/tests/integration/mutation/update/field_kinds/array_bool_test.go @@ -47,9 +47,11 @@ func TestMutationUpdate_WithArrayOfBooleansToNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "likedIndexes": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "likedIndexes": nil, + }, }, }, }, @@ -90,9 +92,11 @@ func TestMutationUpdate_WithArrayOfBooleansToEmpty(t *testing.T) { } } `, - Results: []map[string]any{ - { - "likedIndexes": []bool{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "likedIndexes": []bool{}, + }, }, }, }, @@ -133,9 +137,11 @@ func TestMutationUpdate_WithArrayOfBooleansToSameSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "likedIndexes": []bool{true, false, true, false}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "likedIndexes": []bool{true, false, true, false}, + }, }, }, }, @@ -176,9 +182,11 @@ func TestMutationUpdate_WithArrayOfBooleansToSmallerSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "likedIndexes": []bool{false, true}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "likedIndexes": []bool{false, true}, + }, }, }, }, @@ -219,9 +227,11 @@ func TestMutationUpdate_WithArrayOfBooleansToLargerSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "likedIndexes": []bool{true, false, true, false, true, true}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "likedIndexes": []bool{true, false, true, false, true, true}, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_float_test.go b/tests/integration/mutation/update/field_kinds/array_float_test.go index a1806eadf0..b62af16c41 100644 --- a/tests/integration/mutation/update/field_kinds/array_float_test.go +++ b/tests/integration/mutation/update/field_kinds/array_float_test.go @@ -47,9 +47,11 @@ func TestMutationUpdate_WithArrayOfFloatsToNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteFloats": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteFloats": nil, + }, }, }, }, @@ -90,9 +92,11 @@ func TestMutationUpdate_WithArrayOfFloatsToEmpty(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteFloats": []float64{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteFloats": []float64{}, + }, }, }, }, @@ -133,9 +137,11 @@ func TestMutationUpdate_WithArrayOfFloatsToSameSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteFloats": []float64{3.1425, -0.00000000001, 1000000}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteFloats": []float64{3.1425, -0.00000000001, 1000000}, + }, }, }, }, @@ -176,9 +182,11 @@ func TestMutationUpdate_WithArrayOfFloatsToSmallerSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteFloats": []float64{3.14}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteFloats": []float64{3.14}, + }, }, }, }, @@ -219,9 +227,11 @@ func TestMutationUpdate_WithArrayOfFloatsToLargerSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteFloats": []float64{3.1425, 0.00000000001, -10, 6.626070}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteFloats": []float64{3.1425, 0.00000000001, -10, 6.626070}, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_int_test.go b/tests/integration/mutation/update/field_kinds/array_int_test.go index 63ecfc0969..b906d17fb0 100644 --- a/tests/integration/mutation/update/field_kinds/array_int_test.go +++ b/tests/integration/mutation/update/field_kinds/array_int_test.go @@ -47,9 +47,11 @@ func TestMutationUpdate_WithArrayOfIntsToNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteIntegers": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": nil, + }, }, }, }, @@ -90,9 +92,11 @@ func TestMutationUpdate_WithArrayOfIntsToEmpty(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteIntegers": []int64{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []int64{}, + }, }, }, }, @@ -133,9 +137,11 @@ func TestMutationUpdate_WithArrayOfIntsToSameSizePositiveValues(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteIntegers": []int64{8, 5, 3, 2, 1}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []int64{8, 5, 3, 2, 1}, + }, }, }, }, @@ -176,9 +182,11 @@ func TestMutationUpdate_WithArrayOfIntsToSameSizeMixedValues(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteIntegers": []int64{-1, 2, -3, 5, -8}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []int64{-1, 2, -3, 5, -8}, + }, }, }, }, @@ -219,9 +227,11 @@ func TestMutationUpdate_WithArrayOfIntsToSmallerSizePositiveValues(t *testing.T) } } `, - Results: []map[string]any{ - { - "favouriteIntegers": []int64{1, 2, 3}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []int64{1, 2, 3}, + }, }, }, }, @@ -262,9 +272,11 @@ func TestMutationUpdate_WithArrayOfIntsToLargerSizePositiveValues(t *testing.T) } } `, - Results: []map[string]any{ - { - "favouriteIntegers": []int64{1, 2, 3, 5, 8, 13, 21}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []int64{1, 2, 3, 5, 8, 13, 21}, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_nillable_bool_test.go b/tests/integration/mutation/update/field_kinds/array_nillable_bool_test.go index d069927d5e..8de0d80abc 100644 --- a/tests/integration/mutation/update/field_kinds/array_nillable_bool_test.go +++ b/tests/integration/mutation/update/field_kinds/array_nillable_bool_test.go @@ -49,14 +49,16 @@ func TestMutationUpdate_WithArrayOfNillableBooleans(t *testing.T) { } } `, - Results: []map[string]any{ - { - "likedIndexes": []immutable.Option[bool]{ - immutable.Some(true), - immutable.Some(true), - immutable.Some(false), - immutable.Some(true), - immutable.None[bool](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "likedIndexes": []immutable.Option[bool]{ + immutable.Some(true), + immutable.Some(true), + immutable.Some(false), + immutable.Some(true), + immutable.None[bool](), + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_nillable_float_test.go b/tests/integration/mutation/update/field_kinds/array_nillable_float_test.go index 825461cd4c..d8838ca730 100644 --- a/tests/integration/mutation/update/field_kinds/array_nillable_float_test.go +++ b/tests/integration/mutation/update/field_kinds/array_nillable_float_test.go @@ -49,13 +49,15 @@ func TestMutationUpdate_WithArrayOfNillableFloats(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteFloats": []immutable.Option[float64]{ - immutable.Some(3.1425), - immutable.Some(-0.00000000001), - immutable.None[float64](), - immutable.Some[float64](10), + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteFloats": []immutable.Option[float64]{ + immutable.Some(3.1425), + immutable.Some(-0.00000000001), + immutable.None[float64](), + immutable.Some[float64](10), + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_nillable_int_test.go b/tests/integration/mutation/update/field_kinds/array_nillable_int_test.go index 99e28d2520..639a1671ad 100644 --- a/tests/integration/mutation/update/field_kinds/array_nillable_int_test.go +++ b/tests/integration/mutation/update/field_kinds/array_nillable_int_test.go @@ -49,14 +49,16 @@ func TestMutationUpdate_WithArrayOfNillableInts(t *testing.T) { } } `, - Results: []map[string]any{ - { - "favouriteIntegers": []immutable.Option[int64]{ - immutable.None[int64](), - immutable.Some[int64](2), - immutable.Some[int64](3), - immutable.None[int64](), - immutable.Some[int64](8), + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []immutable.Option[int64]{ + immutable.None[int64](), + immutable.Some[int64](2), + immutable.Some[int64](3), + immutable.None[int64](), + immutable.Some[int64](8), + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_nillable_string_test.go b/tests/integration/mutation/update/field_kinds/array_nillable_string_test.go index eea09e0157..4d4adfcf78 100644 --- a/tests/integration/mutation/update/field_kinds/array_nillable_string_test.go +++ b/tests/integration/mutation/update/field_kinds/array_nillable_string_test.go @@ -49,15 +49,17 @@ func TestMutationUpdate_WithArrayOfStringsInts(t *testing.T) { } } `, - Results: []map[string]any{ - { - "preferredStrings": []immutable.Option[string]{ - immutable.Some(""), - immutable.Some("the previous"), - immutable.None[string](), - immutable.Some("empty string"), - immutable.Some("blank string"), - immutable.Some("hitchi"), + Results: map[string]any{ + "Users": []map[string]any{ + { + "preferredStrings": []immutable.Option[string]{ + immutable.Some(""), + immutable.Some("the previous"), + immutable.None[string](), + immutable.Some("empty string"), + immutable.Some("blank string"), + immutable.Some("hitchi"), + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/array_string_test.go b/tests/integration/mutation/update/field_kinds/array_string_test.go index 3481fb7912..366c5d1912 100644 --- a/tests/integration/mutation/update/field_kinds/array_string_test.go +++ b/tests/integration/mutation/update/field_kinds/array_string_test.go @@ -47,9 +47,11 @@ func TestMutationUpdate_WithArrayOfStringsToNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "preferredStrings": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "preferredStrings": nil, + }, }, }, }, @@ -90,9 +92,11 @@ func TestMutationUpdate_WithArrayOfStringsToEmpty(t *testing.T) { } } `, - Results: []map[string]any{ - { - "preferredStrings": []string{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "preferredStrings": []string{}, + }, }, }, }, @@ -133,9 +137,11 @@ func TestMutationUpdate_WithArrayOfStringsToSameSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "preferredStrings": []string{"zeroth", "the previous", "the first", "null string"}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "preferredStrings": []string{"zeroth", "the previous", "the first", "null string"}, + }, }, }, }, @@ -176,9 +182,11 @@ func TestMutationUpdate_WithArrayOfStringsToSmallerSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "preferredStrings": []string{"", "the first"}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "preferredStrings": []string{"", "the first"}, + }, }, }, }, @@ -219,15 +227,17 @@ func TestMutationUpdate_WithArrayOfStringsToLargerSize(t *testing.T) { } } `, - Results: []map[string]any{ - { - "preferredStrings": []string{ - "", - "the previous", - "the first", - "empty string", - "blank string", - "hitchi", + Results: map[string]any{ + "Users": []map[string]any{ + { + "preferredStrings": []string{ + "", + "the previous", + "the first", + "empty string", + "blank string", + "hitchi", + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/blob_test.go b/tests/integration/mutation/update/field_kinds/blob_test.go index 4434d49ef0..970ed781a7 100644 --- a/tests/integration/mutation/update/field_kinds/blob_test.go +++ b/tests/integration/mutation/update/field_kinds/blob_test.go @@ -47,9 +47,11 @@ func TestMutationUpdate_WithBlobField(t *testing.T) { } } `, - Results: []map[string]any{ - { - "data": "00FF", + Results: map[string]any{ + "Users": []map[string]any{ + { + "data": "00FF", + }, }, }, }, @@ -88,9 +90,11 @@ func TestMutationUpdate_IfBlobFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "data": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "data": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/bool_test.go b/tests/integration/mutation/update/field_kinds/bool_test.go index 36301961ed..5215140203 100644 --- a/tests/integration/mutation/update/field_kinds/bool_test.go +++ b/tests/integration/mutation/update/field_kinds/bool_test.go @@ -45,9 +45,11 @@ func TestMutationUpdate_IfBoolFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "valid": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "valid": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/date_time_test.go b/tests/integration/mutation/update/field_kinds/date_time_test.go index c0ac23c166..1eb8a412bc 100644 --- a/tests/integration/mutation/update/field_kinds/date_time_test.go +++ b/tests/integration/mutation/update/field_kinds/date_time_test.go @@ -47,9 +47,11 @@ func TestMutationUpdate_WithDateTimeField(t *testing.T) { } } `, - Results: []map[string]any{ - { - "created_at": testUtils.MustParseTime("2021-07-23T02:22:22-05:00"), + Results: map[string]any{ + "Users": []map[string]any{ + { + "created_at": testUtils.MustParseTime("2021-07-23T02:22:22-05:00"), + }, }, }, }, @@ -90,14 +92,16 @@ func TestMutationUpdate_WithDateTimeField_MultipleDocs(t *testing.T) { created_at } }`, - Results: []map[string]any{ - { - "name": "Fred", - "created_at": testUtils.MustParseTime("2031-07-23T03:23:23Z"), - }, - { - "name": "John", - "created_at": testUtils.MustParseTime("2031-07-23T03:23:23Z"), + Results: map[string]any{ + "update_Users": []map[string]any{ + { + "name": "Fred", + "created_at": testUtils.MustParseTime("2031-07-23T03:23:23Z"), + }, + { + "name": "John", + "created_at": testUtils.MustParseTime("2031-07-23T03:23:23Z"), + }, }, }, }, @@ -136,9 +140,11 @@ func TestMutationUpdate_IfDateTimeFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "created_at": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "created_at": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/float_test.go b/tests/integration/mutation/update/field_kinds/float_test.go index bb1a9babce..9ef299db17 100644 --- a/tests/integration/mutation/update/field_kinds/float_test.go +++ b/tests/integration/mutation/update/field_kinds/float_test.go @@ -45,9 +45,11 @@ func TestMutationUpdate_IfFloatFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "rate": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "rate": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/int_test.go b/tests/integration/mutation/update/field_kinds/int_test.go index 84a122e080..a30c321e46 100644 --- a/tests/integration/mutation/update/field_kinds/int_test.go +++ b/tests/integration/mutation/update/field_kinds/int_test.go @@ -45,9 +45,11 @@ func TestMutationUpdate_IfIntFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "age": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "age": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/json_test.go b/tests/integration/mutation/update/field_kinds/json_test.go index c782f856a3..868e0c5a7d 100644 --- a/tests/integration/mutation/update/field_kinds/json_test.go +++ b/tests/integration/mutation/update/field_kinds/json_test.go @@ -45,9 +45,11 @@ func TestMutationUpdate_IfJSONFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "custom": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "custom": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go b/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go index 1b515c62fd..e8ac15e4da 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go @@ -116,10 +116,12 @@ func TestMutationUpdateOneToMany_InvalidRelationIDToLinkFromManySide(t *testing. } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{}, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{}, + }, }, }, }, @@ -132,10 +134,12 @@ func TestMutationUpdateOneToMany_InvalidRelationIDToLinkFromManySide(t *testing. } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": nil, // Linked to incorrect id + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": nil, // Linked to incorrect id + }, }, }, }, @@ -246,18 +250,20 @@ func TestMutationUpdateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "New Shahzad", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "New Shahzad", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, - }, - { - "name": "John Grisham", - "published": []map[string]any{}, + { + "name": "John Grisham", + "published": []map[string]any{}, + }, }, }, }, @@ -270,11 +276,13 @@ func TestMutationUpdateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "New Shahzad", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "New Shahzad", + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go b/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go index 5f50e1732b..1f0375e6ba 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go @@ -110,10 +110,12 @@ func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_GQL( } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{}, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{}, + }, }, }, }, @@ -126,10 +128,12 @@ func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_GQL( } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": nil, // Linked to incorrect id + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": nil, // Linked to incorrect id + }, }, }, }, @@ -183,10 +187,12 @@ func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_Coll } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": nil, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": nil, + }, }, }, }, @@ -297,18 +303,20 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySide(t *testing. } } }`, - Results: []map[string]any{ - { - "name": "New Shahzad", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "New Shahzad", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, - }, - { - "name": "John Grisham", - "published": []map[string]any{}, + { + "name": "John Grisham", + "published": []map[string]any{}, + }, }, }, }, @@ -321,11 +329,13 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySide(t *testing. } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "New Shahzad", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "New Shahzad", + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go b/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go index dc49999627..841d30d80c 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go @@ -61,17 +61,19 @@ func TestMutationUpdateOneToOne_SelfReferencingFromPrimary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Fred", - "boss": map[string]any{ + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Fred", + "boss": map[string]any{ + "name": "John", + }, + }, + { "name": "John", + "boss": nil, }, }, - { - "name": "John", - "boss": nil, - }, }, }, testUtils.Request{ @@ -84,15 +86,17 @@ func TestMutationUpdateOneToOne_SelfReferencingFromPrimary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Fred", - "underling": nil, - }, - { - "name": "John", - "underling": map[string]any{ - "name": "Fred", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "Fred", + "underling": nil, + }, + { + "name": "John", + "underling": map[string]any{ + "name": "Fred", + }, }, }, }, @@ -148,15 +152,17 @@ func TestMutationUpdateOneToOne_SelfReferencingFromSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John", - "boss": nil, - }, - { - "name": "Fred", - "boss": map[string]any{ + Results: map[string]any{ + "User": []map[string]any{ + { "name": "John", + "boss": nil, + }, + { + "name": "Fred", + "boss": map[string]any{ + "name": "John", + }, }, }, }, @@ -171,16 +177,18 @@ func TestMutationUpdateOneToOne_SelfReferencingFromSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John", - "underling": map[string]any{ - "name": "Fred", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + "underling": map[string]any{ + "name": "Fred", + }, + }, + { + "name": "Fred", + "underling": nil, }, - }, - { - "name": "Fred", - "underling": nil, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go b/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go index c2df5a9db8..8cbbe963f3 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go @@ -49,9 +49,11 @@ func TestMutationUpdateOneToOneNoChild(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, }, @@ -98,11 +100,13 @@ func TestMutationUpdateOneToOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -117,11 +121,13 @@ func TestMutationUpdateOneToOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, @@ -170,11 +176,13 @@ func TestMutationUpdateOneToOneSecondarySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -189,11 +197,13 @@ func TestMutationUpdateOneToOneSecondarySide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/string_test.go b/tests/integration/mutation/update/field_kinds/string_test.go index 7783f9b0fd..6e665ae301 100644 --- a/tests/integration/mutation/update/field_kinds/string_test.go +++ b/tests/integration/mutation/update/field_kinds/string_test.go @@ -45,9 +45,11 @@ func TestMutationUpdate_IfStringFieldSetToNull_ShouldBeNil(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/underscored_schema_test.go b/tests/integration/mutation/update/underscored_schema_test.go index fa25f22d06..c73c1562e6 100644 --- a/tests/integration/mutation/update/underscored_schema_test.go +++ b/tests/integration/mutation/update/underscored_schema_test.go @@ -46,9 +46,11 @@ func TestMutationUpdateUnderscoredSchema(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Fred", + Results: map[string]any{ + "My_User": []map[string]any{ + { + "name": "Fred", + }, }, }, }, diff --git a/tests/integration/mutation/update/with_filter_test.go b/tests/integration/mutation/update/with_filter_test.go index 1819a8ba0c..43b1faee0f 100644 --- a/tests/integration/mutation/update/with_filter_test.go +++ b/tests/integration/mutation/update/with_filter_test.go @@ -44,7 +44,9 @@ func TestMutationUpdate_WithBooleanFilter_ResultFilteredOut(t *testing.T) { } }`, // As the record no longer matches the filter it is not returned - Results: []map[string]any{}, + Results: map[string]any{ + "update_Users": []map[string]any{}, + }, }, }, } @@ -93,14 +95,16 @@ func TestMutationUpdate_WithBooleanFilter(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": float64(59), - }, - { - "name": "Fred", - "points": float64(59), + Results: map[string]any{ + "update_Users": []map[string]any{ + { + "name": "John", + "points": float64(59), + }, + { + "name": "Fred", + "points": float64(59), + }, }, }, }, diff --git a/tests/integration/mutation/update/with_id_test.go b/tests/integration/mutation/update/with_id_test.go index 342e228052..3aa0cf9b74 100644 --- a/tests/integration/mutation/update/with_id_test.go +++ b/tests/integration/mutation/update/with_id_test.go @@ -48,10 +48,12 @@ func TestMutationUpdate_WithId(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": float64(59), + Results: map[string]any{ + "update_Users": []map[string]any{ + { + "name": "John", + "points": float64(59), + }, }, }, }, @@ -88,7 +90,9 @@ func TestMutationUpdate_WithNonExistantId(t *testing.T) { points } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "update_Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/mutation/update/with_ids_test.go b/tests/integration/mutation/update/with_ids_test.go index 5b7108948f..9afa6a4d02 100644 --- a/tests/integration/mutation/update/with_ids_test.go +++ b/tests/integration/mutation/update/with_ids_test.go @@ -58,14 +58,16 @@ func TestMutationUpdate_WithIds(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": float64(59), - }, - { - "name": "Fred", - "points": float64(59), + Results: map[string]any{ + "update_Users": []map[string]any{ + { + "name": "John", + "points": float64(59), + }, + { + "name": "Fred", + "points": float64(59), + }, }, }, }, diff --git a/tests/integration/net/one_to_many/peer/with_create_update_test.go b/tests/integration/net/one_to_many/peer/with_create_update_test.go index 1cedd82495..812b6380dc 100644 --- a/tests/integration/net/one_to_many/peer/with_create_update_test.go +++ b/tests/integration/net/one_to_many/peer/with_create_update_test.go @@ -78,12 +78,14 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin } } }`, - Results: []map[string]any{ - { - "Name": "Gulistan", - "Author_id": testUtils.NewDocIndex(0, 0), - "Author": map[string]any{ - "Name": "Saadi", + Results: map[string]any{ + "Book": []map[string]any{ + { + "Name": "Gulistan", + "Author_id": testUtils.NewDocIndex(0, 0), + "Author": map[string]any{ + "Name": "Saadi", + }, }, }, }, @@ -99,14 +101,16 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin } } }`, - Results: []map[string]any{ - { - "Name": "Gulistan", - "Author_id": testUtils.NewDocIndex(0, 0), - // "Saadi" was not synced to node 1, the update did not - // result in an error and synced to relational id even though "Saadi" - // does not exist in this node. - "Author": nil, + Results: map[string]any{ + "Book": []map[string]any{ + { + "Name": "Gulistan", + "Author_id": testUtils.NewDocIndex(0, 0), + // "Saadi" was not synced to node 1, the update did not + // result in an error and synced to relational id even though "Saadi" + // does not exist in this node. + "Author": nil, + }, }, }, }, diff --git a/tests/integration/net/one_to_many/replicator/with_create_test.go b/tests/integration/net/one_to_many/replicator/with_create_test.go index 7d2d706805..18fc1e27f0 100644 --- a/tests/integration/net/one_to_many/replicator/with_create_test.go +++ b/tests/integration/net/one_to_many/replicator/with_create_test.go @@ -68,11 +68,13 @@ func TestP2POneToManyReplicator(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "Name": "Gulistan", - "Author": map[string]any{ - "Name": "Saadi", + Results: map[string]any{ + "Book": []map[string]any{ + { + "Name": "Gulistan", + "Author": map[string]any{ + "Name": "Saadi", + }, }, }, }, diff --git a/tests/integration/net/simple/peer/crdt/pcounter_test.go b/tests/integration/net/simple/peer/crdt/pcounter_test.go index 963b7d54cd..569e4bb153 100644 --- a/tests/integration/net/simple/peer/crdt/pcounter_test.go +++ b/tests/integration/net/simple/peer/crdt/pcounter_test.go @@ -56,9 +56,11 @@ func TestP2PUpdate_WithPCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(20), + }, }, }, }, @@ -111,9 +113,11 @@ func TestP2PUpdate_WithPCounterSimultaneousUpdate_NoError(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(90), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(90), + }, }, }, }, diff --git a/tests/integration/net/simple/peer/crdt/pncounter_test.go b/tests/integration/net/simple/peer/crdt/pncounter_test.go index 643ba738de..de0c67fc2c 100644 --- a/tests/integration/net/simple/peer/crdt/pncounter_test.go +++ b/tests/integration/net/simple/peer/crdt/pncounter_test.go @@ -56,9 +56,11 @@ func TestP2PUpdate_WithPNCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(20), + }, }, }, }, @@ -111,9 +113,11 @@ func TestP2PUpdate_WithPNCounterSimultaneousUpdate_NoError(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(90), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(90), + }, }, }, }, diff --git a/tests/integration/net/simple/peer/subscribe/with_add_remove_test.go b/tests/integration/net/simple/peer/subscribe/with_add_remove_test.go index 26dbfdf151..0108d101bd 100644 --- a/tests/integration/net/simple/peer/subscribe/with_add_remove_test.go +++ b/tests/integration/net/simple/peer/subscribe/with_add_remove_test.go @@ -63,9 +63,11 @@ func TestP2PSubscribeAddAndRemoveSingle(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Fred", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + }, }, }, }, @@ -125,7 +127,9 @@ func TestP2PSubscribeAddAndRemoveMultiple(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.Request{ // Gillian the Giraffe has still been synced, as it was not removed from the subscription set. @@ -135,9 +139,11 @@ func TestP2PSubscribeAddAndRemoveMultiple(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Gillian", + Results: map[string]any{ + "Giraffes": []map[string]any{ + { + "name": "Gillian", + }, }, }, }, @@ -187,9 +193,11 @@ func TestP2PSubscribeAddSingleAndRemoveErroneous(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -237,9 +245,11 @@ func TestP2PSubscribeAddSingleAndRemoveNone(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/net/simple/peer/subscribe/with_add_test.go b/tests/integration/net/simple/peer/subscribe/with_add_test.go index 04a1a3d57c..1577925763 100644 --- a/tests/integration/net/simple/peer/subscribe/with_add_test.go +++ b/tests/integration/net/simple/peer/subscribe/with_add_test.go @@ -60,12 +60,14 @@ func TestP2PSubscribeAddSingle(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, + // Peer sync should not sync new documents to nodes that is not subscribed + // to the P2P collection. }, - // Peer sync should not sync new documents to nodes that is not subscribed - // to the P2P collection. }, }, testUtils.Request{ @@ -75,12 +77,14 @@ func TestP2PSubscribeAddSingle(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Fred", - }, - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + }, + { + "name": "John", + }, }, }, }, @@ -144,9 +148,11 @@ func TestP2PSubscribeAddMultiple(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -159,7 +165,9 @@ func TestP2PSubscribeAddMultiple(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Giraffes": []map[string]any{}, + }, }, testUtils.Request{ // Bjorn the Bear has been synced. @@ -168,9 +176,11 @@ func TestP2PSubscribeAddMultiple(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Bjorn", + Results: map[string]any{ + "Bears": []map[string]any{ + { + "name": "Bjorn", + }, }, }, }, @@ -216,7 +226,9 @@ func TestP2PSubscribeAddSingleErroneousCollectionID(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -261,7 +273,9 @@ func TestP2PSubscribeAddValidAndErroneousCollectionID(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -309,9 +323,11 @@ func TestP2PSubscribeAddValidThenErroneousCollectionID(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -355,7 +371,9 @@ func TestP2PSubscribeAddNone(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/net/simple/peer/with_create_add_field_test.go b/tests/integration/net/simple/peer/with_create_add_field_test.go index 22133c78af..1f1c81e160 100644 --- a/tests/integration/net/simple/peer/with_create_add_field_test.go +++ b/tests/integration/net/simple/peer/with_create_add_field_test.go @@ -63,10 +63,12 @@ func TestP2PPeerCreateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { Email } }`, - Results: []map[string]any{ - { - "Name": "John", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -79,9 +81,11 @@ func TestP2PPeerCreateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { Name } }`, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, @@ -136,9 +140,11 @@ func TestP2PPeerCreateWithNewFieldSyncsDocsToNewerSchemaVersion(t *testing.T) { Name } }`, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, @@ -191,10 +197,12 @@ func TestP2PPeerCreateWithNewFieldSyncsDocsToUpdatedSchemaVersion(t *testing.T) Email } }`, - Results: []map[string]any{ - { - "Name": "John", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -263,10 +271,12 @@ func TestP2PPeerCreateWithNewFieldDocSyncedBeforeReceivingNodeSchemaUpdatedDoesN } } `, - Results: []map[string]any{ - { - "Name": "John", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -280,11 +290,13 @@ func TestP2PPeerCreateWithNewFieldDocSyncedBeforeReceivingNodeSchemaUpdatedDoesN } } `, - Results: []map[string]any{ - { - "Name": "John", - // The email should be returned but it is not - "Email": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + // The email should be returned but it is not + "Email": nil, + }, }, }, }, diff --git a/tests/integration/net/simple/peer/with_create_test.go b/tests/integration/net/simple/peer/with_create_test.go index e89030690d..8d67268396 100644 --- a/tests/integration/net/simple/peer/with_create_test.go +++ b/tests/integration/net/simple/peer/with_create_test.go @@ -57,12 +57,14 @@ func TestP2PCreateDoesNotSync(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(300), - }, - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(300), + }, + { + "Age": int64(21), + }, }, }, }, @@ -73,11 +75,13 @@ func TestP2PCreateDoesNotSync(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(300), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(300), + }, + // Peer sync should not sync new documents to nodes }, - // Peer sync should not sync new documents to nodes }, }, }, @@ -145,18 +149,20 @@ func TestP2PCreateWithP2PCollection(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(28), - }, - { - "Age": int64(30), - }, - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(28), + }, + { + "Age": int64(30), + }, + { + "Age": int64(21), + }, + // Peer sync should not sync new documents to nodes that is not subscribed + // to the P2P collection. }, - // Peer sync should not sync new documents to nodes that is not subscribed - // to the P2P collection. }, }, testUtils.Request{ @@ -166,18 +172,20 @@ func TestP2PCreateWithP2PCollection(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(28), - }, - { - "Age": int64(30), - }, - { - "Age": int64(21), - }, - { - "Age": int64(31), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(28), + }, + { + "Age": int64(30), + }, + { + "Age": int64(21), + }, + { + "Age": int64(31), + }, }, }, }, diff --git a/tests/integration/net/simple/peer/with_delete_test.go b/tests/integration/net/simple/peer/with_delete_test.go index 01f03e2c75..dba1c368fd 100644 --- a/tests/integration/net/simple/peer/with_delete_test.go +++ b/tests/integration/net/simple/peer/with_delete_test.go @@ -64,11 +64,13 @@ func TestP2PWithMultipleDocumentsSingleDelete(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -122,16 +124,18 @@ func TestP2PWithMultipleDocumentsSingleDeleteWithShowDeleted(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(43), - }, - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(43), + }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -193,16 +197,18 @@ func TestP2PWithMultipleDocumentsWithSingleUpdateBeforeConnectSingleDeleteWithSh Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(60), - }, - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(60), + }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -272,16 +278,18 @@ func TestP2PWithMultipleDocumentsWithMultipleUpdatesBeforeConnectSingleDeleteWit Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(62), - }, - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(62), + }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -360,16 +368,18 @@ func TestP2PWithMultipleDocumentsWithUpdateAndDeleteBeforeConnectSingleDeleteWit Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(62), - }, - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(62), + }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -384,16 +394,18 @@ func TestP2PWithMultipleDocumentsWithUpdateAndDeleteBeforeConnectSingleDeleteWit Age } }`, - Results: []map[string]any{ - { - "_deleted": false, - "Name": "John", - "Age": int64(66), - }, - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": false, + "Name": "John", + "Age": int64(66), + }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, diff --git a/tests/integration/net/simple/peer/with_update_add_field_test.go b/tests/integration/net/simple/peer/with_update_add_field_test.go index 88e86a75a3..c7a7d9f0f6 100644 --- a/tests/integration/net/simple/peer/with_update_add_field_test.go +++ b/tests/integration/net/simple/peer/with_update_add_field_test.go @@ -76,10 +76,12 @@ func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t *test Email } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -91,9 +93,11 @@ func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t *test Name } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + }, }, }, }, @@ -154,10 +158,12 @@ func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { Email } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -168,9 +174,11 @@ func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { Name } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + }, }, }, }, diff --git a/tests/integration/net/simple/peer/with_update_restart_test.go b/tests/integration/net/simple/peer/with_update_restart_test.go index 2f68870be4..92c44dd7b3 100644 --- a/tests/integration/net/simple/peer/with_update_restart_test.go +++ b/tests/integration/net/simple/peer/with_update_restart_test.go @@ -57,9 +57,11 @@ func TestP2PWithSingleDocumentSingleUpdateFromChildAndRestart(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, diff --git a/tests/integration/net/simple/peer/with_update_test.go b/tests/integration/net/simple/peer/with_update_test.go index 5a04cd6034..54c7aeb3de 100644 --- a/tests/integration/net/simple/peer/with_update_test.go +++ b/tests/integration/net/simple/peer/with_update_test.go @@ -58,9 +58,11 @@ func TestP2PWithSingleDocumentSingleUpdateFromChild(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -110,9 +112,11 @@ func TestP2PWithSingleDocumentSingleUpdateFromParent(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -168,9 +172,11 @@ func TestP2PWithSingleDocumentUpdatePerNode(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": testUtils.AnyOf{int64(45), int64(60)}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": testUtils.AnyOf{int64(45), int64(60)}, + }, }, }, }, @@ -221,9 +227,11 @@ func TestP2PWithSingleDocumentSingleUpdateDoesNotSyncToNonPeerNode(t *testing.T) Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -234,9 +242,11 @@ func TestP2PWithSingleDocumentSingleUpdateDoesNotSyncToNonPeerNode(t *testing.T) Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -248,9 +258,11 @@ func TestP2PWithSingleDocumentSingleUpdateDoesNotSyncToNonPeerNode(t *testing.T) Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -303,9 +315,11 @@ func TestP2PWithSingleDocumentSingleUpdateDoesNotSyncFromUnmappedNode(t *testing Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -317,9 +331,11 @@ func TestP2PWithSingleDocumentSingleUpdateDoesNotSyncFromUnmappedNode(t *testing Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -330,9 +346,11 @@ func TestP2PWithSingleDocumentSingleUpdateDoesNotSyncFromUnmappedNode(t *testing Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -410,9 +428,11 @@ func TestP2PWithMultipleDocumentUpdatesPerNode(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": testUtils.AnyOf{int64(47), int64(62)}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": testUtils.AnyOf{int64(47), int64(62)}, + }, }, }, }, @@ -473,12 +493,14 @@ func TestP2PWithSingleDocumentSingleUpdateFromChildWithP2PCollection(t *testing. Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), - }, - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, + { + "Age": int64(60), + }, }, }, }, @@ -589,12 +611,14 @@ func TestP2PWithMultipleDocumentUpdatesPerNodeWithP2PCollection(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": testUtils.AnyOf{int64(47), int64(62)}, - }, - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": testUtils.AnyOf{int64(47), int64(62)}, + }, + { + "Age": int64(60), + }, }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/crdt/pcounter_test.go b/tests/integration/net/simple/peer_replicator/crdt/pcounter_test.go index a7b3c67a59..914f8daba3 100644 --- a/tests/integration/net/simple/peer_replicator/crdt/pcounter_test.go +++ b/tests/integration/net/simple/peer_replicator/crdt/pcounter_test.go @@ -61,12 +61,14 @@ func TestP2PPeerReplicatorWithCreate_PCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(0), - }, - { - "points": int64(3000), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(0), + }, + { + "points": int64(3000), + }, }, }, }, @@ -77,9 +79,11 @@ func TestP2PPeerReplicatorWithCreate_PCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(0), + }, }, }, }, @@ -90,12 +94,14 @@ func TestP2PPeerReplicatorWithCreate_PCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(0), - }, - { - "points": int64(3000), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(0), + }, + { + "points": int64(3000), + }, }, }, }, @@ -147,9 +153,11 @@ func TestP2PPeerReplicatorWithUpdate_PCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(20), + }, }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/crdt/pncounter_test.go b/tests/integration/net/simple/peer_replicator/crdt/pncounter_test.go index 40eba568ba..b990631880 100644 --- a/tests/integration/net/simple/peer_replicator/crdt/pncounter_test.go +++ b/tests/integration/net/simple/peer_replicator/crdt/pncounter_test.go @@ -61,12 +61,14 @@ func TestP2PPeerReplicatorWithCreate_PNCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(0), - }, - { - "points": int64(3000), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(0), + }, + { + "points": int64(3000), + }, }, }, }, @@ -77,9 +79,11 @@ func TestP2PPeerReplicatorWithCreate_PNCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(0), + }, }, }, }, @@ -90,12 +94,14 @@ func TestP2PPeerReplicatorWithCreate_PNCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(0), - }, - { - "points": int64(3000), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(0), + }, + { + "points": int64(3000), + }, }, }, }, @@ -147,9 +153,11 @@ func TestP2PPeerReplicatorWithUpdate_PNCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(20), + }, }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/with_create_test.go b/tests/integration/net/simple/peer_replicator/with_create_test.go index 3b1f299cfa..bc3ef61e78 100644 --- a/tests/integration/net/simple/peer_replicator/with_create_test.go +++ b/tests/integration/net/simple/peer_replicator/with_create_test.go @@ -61,12 +61,14 @@ func TestP2PPeerReplicatorWithCreate(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(3000), - }, - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(3000), + }, + { + "Age": int64(21), + }, }, }, }, @@ -77,9 +79,11 @@ func TestP2PPeerReplicatorWithCreate(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -90,12 +94,14 @@ func TestP2PPeerReplicatorWithCreate(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(3000), - }, - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(3000), + }, + { + "Age": int64(21), + }, }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/with_delete_test.go b/tests/integration/net/simple/peer_replicator/with_delete_test.go index 1d73e53da7..efb38243a7 100644 --- a/tests/integration/net/simple/peer_replicator/with_delete_test.go +++ b/tests/integration/net/simple/peer_replicator/with_delete_test.go @@ -60,11 +60,13 @@ func TestP2PPeerReplicatorWithDeleteShowDeleted(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(21), + }, }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/with_update_restart_test.go b/tests/integration/net/simple/peer_replicator/with_update_restart_test.go index b908e5ae38..298b18dc13 100644 --- a/tests/integration/net/simple/peer_replicator/with_update_restart_test.go +++ b/tests/integration/net/simple/peer_replicator/with_update_restart_test.go @@ -65,9 +65,11 @@ func TestP2PPeerReplicatorWithUpdateAndRestart(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/with_update_test.go b/tests/integration/net/simple/peer_replicator/with_update_test.go index 7e7e2682b5..f0eb677af3 100644 --- a/tests/integration/net/simple/peer_replicator/with_update_test.go +++ b/tests/integration/net/simple/peer_replicator/with_update_test.go @@ -60,9 +60,11 @@ func TestP2PPeerReplicatorWithUpdate(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/crdt/pcounter_test.go b/tests/integration/net/simple/replicator/crdt/pcounter_test.go index 33ea5d136d..2062b912df 100644 --- a/tests/integration/net/simple/replicator/crdt/pcounter_test.go +++ b/tests/integration/net/simple/replicator/crdt/pcounter_test.go @@ -58,9 +58,11 @@ func TestP2POneToOneReplicatorUpdate_PCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(20), + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/crdt/pncounter_test.go b/tests/integration/net/simple/replicator/crdt/pncounter_test.go index 186a524e4e..48d1783504 100644 --- a/tests/integration/net/simple/replicator/crdt/pncounter_test.go +++ b/tests/integration/net/simple/replicator/crdt/pncounter_test.go @@ -58,9 +58,11 @@ func TestP2POneToOneReplicatorUpdate_PNCounter_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "points": int64(20), + Results: map[string]any{ + "Users": []map[string]any{ + { + "points": int64(20), + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_create_add_field_test.go b/tests/integration/net/simple/replicator/with_create_add_field_test.go index f73c731666..456e3bb1b8 100644 --- a/tests/integration/net/simple/replicator/with_create_add_field_test.go +++ b/tests/integration/net/simple/replicator/with_create_add_field_test.go @@ -58,9 +58,11 @@ func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToOlderSchemaVersion(t Name } }`, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, @@ -109,9 +111,11 @@ func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToNewerSchemaVersion(t Name } }`, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, @@ -161,10 +165,12 @@ func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToUpdatedSchemaVersion( Email } }`, - Results: []map[string]any{ - { - "Name": "John", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_create_restart_test.go b/tests/integration/net/simple/replicator/with_create_restart_test.go index 92ad213dd0..a5a52d1ebc 100644 --- a/tests/integration/net/simple/replicator/with_create_restart_test.go +++ b/tests/integration/net/simple/replicator/with_create_restart_test.go @@ -51,9 +51,11 @@ func TestP2POneToOneReplicatorWithRestart(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_create_test.go b/tests/integration/net/simple/replicator/with_create_test.go index 08ef2baeec..1eab640b83 100644 --- a/tests/integration/net/simple/replicator/with_create_test.go +++ b/tests/integration/net/simple/replicator/with_create_test.go @@ -51,9 +51,11 @@ func TestP2POneToOneReplicator(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -96,9 +98,11 @@ func TestP2POneToOneReplicatorDoesNotSyncExisting(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -142,7 +146,9 @@ func TestP2POneToOneReplicatorDoesNotSyncFromTargetToSource(t *testing.T) { Age } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -190,7 +196,9 @@ func TestP2POneToOneReplicatorDoesNotSyncFromDeletedReplicator(t *testing.T) { Age } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -235,9 +243,11 @@ func TestP2POneToManyReplicator(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -282,9 +292,11 @@ func TestP2POneToOneOfManyReplicator(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -295,9 +307,11 @@ func TestP2POneToOneOfManyReplicator(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -309,7 +323,9 @@ func TestP2POneToOneOfManyReplicator(t *testing.T) { } }`, // As node[2] was not configured, John should not be synced to it - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -357,12 +373,14 @@ func TestP2POneToOneReplicatorManyDocs(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(22), - }, - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(22), + }, + { + "Age": int64(21), + }, }, }, }, @@ -417,12 +435,14 @@ func TestP2POneToManyReplicatorManyDocs(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(22), - }, - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(22), + }, + { + "Age": int64(21), + }, }, }, }, @@ -483,14 +503,16 @@ func TestP2POneToOneReplicatorOrderIndependent(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "_docID": "bae-0b2f15e5-bfe7-5cb7-8045-471318d7dbc3", - "age": int64(21), - "name": "John", - "_version": []map[string]any{ - { - "schemaVersionId": "bafkreihhd6bqrjhl5zidwztgxzeseveplv3cj3fwtn3unjkdx7j2vr2vrq", + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-0b2f15e5-bfe7-5cb7-8045-471318d7dbc3", + "age": int64(21), + "name": "John", + "_version": []map[string]any{ + { + "schemaVersionId": "bafkreihhd6bqrjhl5zidwztgxzeseveplv3cj3fwtn3unjkdx7j2vr2vrq", + }, }, }, }, @@ -545,12 +567,14 @@ func TestP2POneToOneReplicatorOrderIndependentDirectCreate(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "_docID": "bae-0b2f15e5-bfe7-5cb7-8045-471318d7dbc3", - "_version": []map[string]any{ - { - "schemaVersionId": "bafkreihhd6bqrjhl5zidwztgxzeseveplv3cj3fwtn3unjkdx7j2vr2vrq", + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-0b2f15e5-bfe7-5cb7-8045-471318d7dbc3", + "_version": []map[string]any{ + { + "schemaVersionId": "bafkreihhd6bqrjhl5zidwztgxzeseveplv3cj3fwtn3unjkdx7j2vr2vrq", + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_create_update_test.go b/tests/integration/net/simple/replicator/with_create_update_test.go index a8b259d46e..a47c0fd0d5 100644 --- a/tests/integration/net/simple/replicator/with_create_update_test.go +++ b/tests/integration/net/simple/replicator/with_create_update_test.go @@ -59,9 +59,11 @@ func TestP2POneToOneReplicatorWithCreateWithUpdate(t *testing.T) { Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -116,9 +118,11 @@ func TestP2POneToOneReplicatorWithCreateWithUpdateOnRecipientNode(t *testing.T) Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -180,9 +184,11 @@ func TestP2POneToOneReplicatorDoesNotUpdateDocExistingOnlyOnTarget(t *testing.T) Name } }`, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_delete_test.go b/tests/integration/net/simple/replicator/with_delete_test.go index 89a715d356..535b22427e 100644 --- a/tests/integration/net/simple/replicator/with_delete_test.go +++ b/tests/integration/net/simple/replicator/with_delete_test.go @@ -58,11 +58,13 @@ func TestP2POneToOneReplicatorDeletesDocCreatedBeforeReplicatorConfig(t *testing Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -112,11 +114,13 @@ func TestP2POneToOneReplicatorDeletesDocCreatedBeforeReplicatorConfigWithNodesIn Age } }`, - Results: []map[string]any{ - { - "_deleted": true, - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_deleted": true, + "Name": "John", + "Age": int64(21), + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_update_add_field_test.go b/tests/integration/net/simple/replicator/with_update_add_field_test.go index 52f67d324d..ae0e86d2b4 100644 --- a/tests/integration/net/simple/replicator/with_update_add_field_test.go +++ b/tests/integration/net/simple/replicator/with_update_add_field_test.go @@ -72,10 +72,12 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t Email } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -87,9 +89,11 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t Name } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + }, }, }, }, @@ -146,10 +150,12 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing Email } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", - "Email": "imnotyourbuddyguy@source.ca", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, }, }, }, @@ -160,9 +166,11 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing Name } }`, - Results: []map[string]any{ - { - "Name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Shahzad", + }, }, }, }, diff --git a/tests/integration/net/simple/replicator/with_update_test.go b/tests/integration/net/simple/replicator/with_update_test.go index 60891f54e3..32175dac3b 100644 --- a/tests/integration/net/simple/replicator/with_update_test.go +++ b/tests/integration/net/simple/replicator/with_update_test.go @@ -58,9 +58,11 @@ func TestP2POneToOneReplicatorUpdatesDocCreatedBeforeReplicatorConfig(t *testing Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, @@ -110,9 +112,11 @@ func TestP2POneToOneReplicatorUpdatesDocCreatedBeforeReplicatorConfigWithNodesIn Age } }`, - Results: []map[string]any{ - { - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(60), + }, }, }, }, diff --git a/tests/integration/query/commits/simple_test.go b/tests/integration/query/commits/simple_test.go index dfb0fcc0ad..a1be0a7986 100644 --- a/tests/integration/query/commits/simple_test.go +++ b/tests/integration/query/commits/simple_test.go @@ -34,15 +34,17 @@ func TestQueryCommits(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -77,24 +79,26 @@ func TestQueryCommitsMultipleDocs(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreihpasbgxcoxmzv5bp6euq3lbaoh5y5wjbbgfthtxqs3nppk36kebq", - }, - { - "cid": "bafyreihe3jydldbt7mvkiae6asrchdxajzkxwid6syi436nmrpcqhwt7xa", - }, - { - "cid": "bafyreihb5eo3luqoojztdmxtg3tdpvm6pc64mkyrzlefbdauker5qlnop4", - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihpasbgxcoxmzv5bp6euq3lbaoh5y5wjbbgfthtxqs3nppk36kebq", + }, + { + "cid": "bafyreihe3jydldbt7mvkiae6asrchdxajzkxwid6syi436nmrpcqhwt7xa", + }, + { + "cid": "bafyreihb5eo3luqoojztdmxtg3tdpvm6pc64mkyrzlefbdauker5qlnop4", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -123,18 +127,20 @@ func TestQueryCommitsWithSchemaVersionIDField(t *testing.T) { schemaVersionId } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + }, }, }, }, @@ -163,15 +169,17 @@ func TestQueryCommitsWithFieldNameField(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fieldName": "age", - }, - { - "fieldName": "name", - }, - { - "fieldName": nil, + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldName": "age", + }, + { + "fieldName": "name", + }, + { + "fieldName": nil, + }, }, }, }, @@ -205,21 +213,23 @@ func TestQueryCommitsWithFieldNameFieldAndUpdate(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fieldName": "age", - }, - { - "fieldName": "age", - }, - { - "fieldName": "name", - }, - { - "fieldName": nil, - }, - { - "fieldName": nil, + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldName": "age", + }, + { + "fieldName": "age", + }, + { + "fieldName": "name", + }, + { + "fieldName": nil, + }, + { + "fieldName": nil, + }, }, }, }, @@ -248,15 +258,17 @@ func TestQueryCommitsWithFieldIDField(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fieldId": "1", - }, - { - "fieldId": "2", - }, - { - "fieldId": "C", + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldId": "1", + }, + { + "fieldId": "2", + }, + { + "fieldId": "C", + }, }, }, }, @@ -290,21 +302,23 @@ func TestQueryCommitsWithFieldIDFieldWithUpdate(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fieldId": "1", - }, - { - "fieldId": "1", - }, - { - "fieldId": "2", - }, - { - "fieldId": "C", - }, - { - "fieldId": "C", + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldId": "1", + }, + { + "fieldId": "1", + }, + { + "fieldId": "2", + }, + { + "fieldId": "C", + }, + { + "fieldId": "C", + }, }, }, }, @@ -347,77 +361,79 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { } } `, - Results: []map[string]any{ - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "collectionID": int64(1), - "delta": testUtils.CBORValue(22), - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - "fieldId": "1", - "fieldName": "age", - "height": int64(2), - "links": []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "_head", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "collectionID": int64(1), + "delta": testUtils.CBORValue(22), + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + "fieldId": "1", + "fieldName": "age", + "height": int64(2), + "links": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "_head", + }, }, }, - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "collectionID": int64(1), - "delta": testUtils.CBORValue(21), - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - "fieldId": "1", - "fieldName": "age", - "height": int64(1), - "links": []map[string]any{}, - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "collectionID": int64(1), - "delta": testUtils.CBORValue("John"), - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - "fieldId": "2", - "fieldName": "name", - "height": int64(1), - "links": []map[string]any{}, - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "collectionID": int64(1), - "delta": nil, - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - "fieldId": "C", - "fieldName": nil, - "height": int64(2), - "links": []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "name": "_head", - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "name": "age", - }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "collectionID": int64(1), + "delta": testUtils.CBORValue(21), + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + "fieldId": "1", + "fieldName": "age", + "height": int64(1), + "links": []map[string]any{}, }, - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "collectionID": int64(1), - "delta": nil, - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - "fieldId": "C", - "fieldName": nil, - "height": int64(1), - "links": []map[string]any{ - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "name": "name", + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "collectionID": int64(1), + "delta": testUtils.CBORValue("John"), + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + "fieldId": "2", + "fieldName": "name", + "height": int64(1), + "links": []map[string]any{}, + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "collectionID": int64(1), + "delta": nil, + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + "fieldId": "C", + "fieldName": nil, + "height": int64(2), + "links": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "name": "_head", + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "name": "age", + }, }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "age", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "collectionID": int64(1), + "delta": nil, + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + "fieldId": "C", + "fieldName": nil, + "height": int64(1), + "links": []map[string]any{ + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "name": "name", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "age", + }, }, }, }, diff --git a/tests/integration/query/commits/with_cid_test.go b/tests/integration/query/commits/with_cid_test.go index 443577ac28..b051e2b289 100644 --- a/tests/integration/query/commits/with_cid_test.go +++ b/tests/integration/query/commits/with_cid_test.go @@ -43,9 +43,11 @@ func TestQueryCommitsWithCid(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -76,9 +78,11 @@ func TestQueryCommitsWithCidForFieldCommit(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -108,7 +112,9 @@ func TestQueryCommitsWithInvalidCid(t *testing.T) { delta } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -136,7 +142,9 @@ func TestQueryCommitsWithInvalidShortCid(t *testing.T) { delta } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -164,7 +172,9 @@ func TestQueryCommitsWithUnknownCid(t *testing.T) { delta } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/query/commits/with_collectionid_group_order_test.go b/tests/integration/query/commits/with_collectionid_group_order_test.go index f39fcbd87c..ce083aedfa 100644 --- a/tests/integration/query/commits/with_collectionid_group_order_test.go +++ b/tests/integration/query/commits/with_collectionid_group_order_test.go @@ -41,12 +41,14 @@ func TestQueryCommitsWithCollectionIDGroupedAndOrderedDesc(t *testing.T) { collectionID } }`, - Results: []map[string]any{ - { - "collectionID": int64(2), - }, - { - "collectionID": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "collectionID": int64(2), + }, + { + "collectionID": int64(1), + }, }, }, }, @@ -81,12 +83,14 @@ func TestQueryCommitsWithCollectionIDGroupedAndOrderedAs(t *testing.T) { collectionID } }`, - Results: []map[string]any{ - { - "collectionID": int64(1), - }, - { - "collectionID": int64(2), + Results: map[string]any{ + "commits": []map[string]any{ + { + "collectionID": int64(1), + }, + { + "collectionID": int64(2), + }, }, }, }, diff --git a/tests/integration/query/commits/with_collectionid_prop_test.go b/tests/integration/query/commits/with_collectionid_prop_test.go index 91d4d60373..261ac937c3 100644 --- a/tests/integration/query/commits/with_collectionid_prop_test.go +++ b/tests/integration/query/commits/with_collectionid_prop_test.go @@ -41,21 +41,23 @@ func TestQueryCommitsWithCollectionID(t *testing.T) { collectionID } }`, - Results: []map[string]any{ - { - "collectionID": int64(1), - }, - { - "collectionID": int64(1), - }, - { - "collectionID": int64(1), - }, - { - "collectionID": int64(2), - }, - { - "collectionID": int64(2), + Results: map[string]any{ + "commits": []map[string]any{ + { + "collectionID": int64(1), + }, + { + "collectionID": int64(1), + }, + { + "collectionID": int64(1), + }, + { + "collectionID": int64(2), + }, + { + "collectionID": int64(2), + }, }, }, }, diff --git a/tests/integration/query/commits/with_depth_test.go b/tests/integration/query/commits/with_depth_test.go index a55828115f..71d805307f 100644 --- a/tests/integration/query/commits/with_depth_test.go +++ b/tests/integration/query/commits/with_depth_test.go @@ -34,15 +34,17 @@ func TestQueryCommitsWithDepth1(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -78,20 +80,22 @@ func TestQueryCommitsWithDepth1WithUpdate(t *testing.T) { height } }`, - Results: []map[string]any{ - { - // "Age" field head - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - // "Name" field head (unchanged from create) - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), + Results: map[string]any{ + "commits": []map[string]any{ + { + // "Age" field head + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + // "Name" field head (unchanged from create) + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, }, }, }, @@ -134,31 +138,33 @@ func TestQueryCommitsWithDepth2WithUpdate(t *testing.T) { height } }`, - Results: []map[string]any{ - { - // Composite head - "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", - "height": int64(3), - }, - { - // Composite head -1 - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - // "Name" field head (unchanged from create) - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - // "Age" field head - "cid": "bafyreieydjk3sqrxs5aqhsiy7ct25vu5qtbtpmzbytzee4apeidx6dq7je", - "height": int64(3), - }, - { - // "Age" field head -1 - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), + Results: map[string]any{ + "commits": []map[string]any{ + { + // Composite head + "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", + "height": int64(3), + }, + { + // Composite head -1 + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + // "Name" field head (unchanged from create) + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + // "Age" field head + "cid": "bafyreieydjk3sqrxs5aqhsiy7ct25vu5qtbtpmzbytzee4apeidx6dq7je", + "height": int64(3), + }, + { + // "Age" field head -1 + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, }, }, }, @@ -193,24 +199,26 @@ func TestQueryCommitsWithDepth1AndMultipleDocs(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreibzfxudkhrcsz7lsgtb637gzyegsdkehlugvb2dg76smhhnkg46dm", - }, - { - "cid": "bafyreiabiarng2rcvkfgoirnnyy3yvd7yi3c66akovkbmhivrxvdawtcna", - }, - { - "cid": "bafyreibubqh6ltxbxmtrtd5oczaekcfw5knqfyocnwkdwhpjatl7johoue", - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreibzfxudkhrcsz7lsgtb637gzyegsdkehlugvb2dg76smhhnkg46dm", + }, + { + "cid": "bafyreiabiarng2rcvkfgoirnnyy3yvd7yi3c66akovkbmhivrxvdawtcna", + }, + { + "cid": "bafyreibubqh6ltxbxmtrtd5oczaekcfw5knqfyocnwkdwhpjatl7johoue", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_cid_test.go b/tests/integration/query/commits/with_doc_id_cid_test.go index 7cbdc10307..bba28526a8 100644 --- a/tests/integration/query/commits/with_doc_id_cid_test.go +++ b/tests/integration/query/commits/with_doc_id_cid_test.go @@ -37,7 +37,9 @@ func TestQueryCommitsWithDocIDAndCidForDifferentDoc(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -73,7 +75,9 @@ func TestQueryCommitsWithDocIDAndCidForDifferentDocWithUpdate(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -109,9 +113,11 @@ func TestQueryCommitsWithDocIDAndCidWithUpdate(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_count_test.go b/tests/integration/query/commits/with_doc_id_count_test.go index d3a7ca0fbb..607822abec 100644 --- a/tests/integration/query/commits/with_doc_id_count_test.go +++ b/tests/integration/query/commits/with_doc_id_count_test.go @@ -35,18 +35,20 @@ func TestQueryCommitsWithDocIDAndLinkCount(t *testing.T) { _count(field: links) } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "_count": 0, - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "_count": 0, - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "_count": 2, + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "_count": 0, + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "_count": 0, + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "_count": 2, + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_field_test.go b/tests/integration/query/commits/with_doc_id_field_test.go index 84821938a0..3b36e9f9d8 100644 --- a/tests/integration/query/commits/with_doc_id_field_test.go +++ b/tests/integration/query/commits/with_doc_id_field_test.go @@ -34,7 +34,9 @@ func TestQueryCommitsWithDocIDAndUnknownField(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -60,7 +62,9 @@ func TestQueryCommitsWithDocIDAndUnknownFieldId(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -88,7 +92,9 @@ func TestQueryCommitsWithDocIDAndField(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -116,9 +122,11 @@ func TestQueryCommitsWithDocIDAndFieldId(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, }, }, }, @@ -148,9 +156,11 @@ func TestQueryCommitsWithDocIDAndCompositeFieldId(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_group_order_test.go b/tests/integration/query/commits/with_doc_id_group_order_test.go index 5443b4e427..0314c43047 100644 --- a/tests/integration/query/commits/with_doc_id_group_order_test.go +++ b/tests/integration/query/commits/with_doc_id_group_order_test.go @@ -41,12 +41,14 @@ func TestQueryCommitsOrderedAndGroupedByDocID(t *testing.T) { docID } }`, - Results: []map[string]any{ - { - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - }, - { - "docID": "bae-a839588e-e2e5-5ede-bb91-ffe6871645cb", + Results: map[string]any{ + "commits": []map[string]any{ + { + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + }, + { + "docID": "bae-a839588e-e2e5-5ede-bb91-ffe6871645cb", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_limit_offset_test.go b/tests/integration/query/commits/with_doc_id_limit_offset_test.go index 68cca30bdc..2fb095a263 100644 --- a/tests/integration/query/commits/with_doc_id_limit_offset_test.go +++ b/tests/integration/query/commits/with_doc_id_limit_offset_test.go @@ -55,12 +55,14 @@ func TestQueryCommitsWithDocIDAndLimitAndOffset(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_limit_test.go b/tests/integration/query/commits/with_doc_id_limit_test.go index 090417fc64..5a569f3295 100644 --- a/tests/integration/query/commits/with_doc_id_limit_test.go +++ b/tests/integration/query/commits/with_doc_id_limit_test.go @@ -48,12 +48,14 @@ func TestQueryCommitsWithDocIDAndLimit(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go b/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go index 4260940370..389ec5c291 100644 --- a/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go +++ b/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go @@ -56,14 +56,16 @@ func TestQueryCommitsWithDocIDAndOrderAndLimitAndOffset(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), - }, - { - "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", - "height": int64(3), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, + { + "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", + "height": int64(3), + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_order_test.go b/tests/integration/query/commits/with_doc_id_order_test.go index 922c87dc7b..ba0ff67def 100644 --- a/tests/integration/query/commits/with_doc_id_order_test.go +++ b/tests/integration/query/commits/with_doc_id_order_test.go @@ -42,26 +42,28 @@ func TestQueryCommitsWithDocIDAndOrderHeightDesc(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "height": int64(1), - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "height": int64(1), + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "height": int64(1), + }, }, }, }, @@ -97,26 +99,28 @@ func TestQueryCommitsWithDocIDAndOrderHeightAsc(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "height": int64(1), - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "height": int64(1), - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "height": int64(1), + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "height": int64(1), + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, }, }, }, @@ -152,26 +156,28 @@ func TestQueryCommitsWithDocIDAndOrderCidDesc(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "height": int64(1), - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "height": int64(1), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "height": int64(1), + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "height": int64(1), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, }, }, }, @@ -207,26 +213,28 @@ func TestQueryCommitsWithDocIDAndOrderCidAsc(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "height": int64(1), - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "height": int64(1), + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "height": int64(1), + }, }, }, }, @@ -276,42 +284,44 @@ func TestQueryCommitsWithDocIDAndOrderAndMultiUpdatesCidAsc(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "height": int64(1), - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "height": int64(1), - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), - }, - { - "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", - "height": int64(3), - }, - { - "cid": "bafyreieydjk3sqrxs5aqhsiy7ct25vu5qtbtpmzbytzee4apeidx6dq7je", - "height": int64(3), - }, - { - "cid": "bafyreic6rjkn7qsoxpboviode2l64ahg4yajsrb3p25zeooisnaxcweccu", - "height": int64(4), - }, - { - "cid": "bafyreieifkfzufdvlvni4o5pbdtuvm3w6x4fnqyelyq2owvsliiwjvddpi", - "height": int64(4), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "height": int64(1), + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "height": int64(1), + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, + { + "cid": "bafyreibpiyrugj4gku336wp5lvcw3fgyxqpjvugm3t4z7v5h3ulwxs3x2y", + "height": int64(3), + }, + { + "cid": "bafyreieydjk3sqrxs5aqhsiy7ct25vu5qtbtpmzbytzee4apeidx6dq7je", + "height": int64(3), + }, + { + "cid": "bafyreic6rjkn7qsoxpboviode2l64ahg4yajsrb3p25zeooisnaxcweccu", + "height": int64(4), + }, + { + "cid": "bafyreieifkfzufdvlvni4o5pbdtuvm3w6x4fnqyelyq2owvsliiwjvddpi", + "height": int64(4), + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_prop_test.go b/tests/integration/query/commits/with_doc_id_prop_test.go index 1d370ab27a..02ad9fe50e 100644 --- a/tests/integration/query/commits/with_doc_id_prop_test.go +++ b/tests/integration/query/commits/with_doc_id_prop_test.go @@ -34,15 +34,17 @@ func TestQueryCommitsWithDocIDProperty(t *testing.T) { docID } }`, - Results: []map[string]any{ - { - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - }, - { - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", - }, - { - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + Results: map[string]any{ + "commits": []map[string]any{ + { + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + }, + { + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + }, + { + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_test.go b/tests/integration/query/commits/with_doc_id_test.go index c716cd296e..26fa6136af 100644 --- a/tests/integration/query/commits/with_doc_id_test.go +++ b/tests/integration/query/commits/with_doc_id_test.go @@ -34,7 +34,9 @@ func TestQueryCommitsWithUnknownDocID(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -60,15 +62,17 @@ func TestQueryCommitsWithDocID(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -100,25 +104,27 @@ func TestQueryCommitsWithDocIDAndLinks(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "links": []map[string]any{}, - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "links": []map[string]any{}, - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "links": []map[string]any{ - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "name": "name", - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "age", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "links": []map[string]any{}, + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "links": []map[string]any{}, + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "links": []map[string]any{ + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "name": "name", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "age", + }, }, }, }, @@ -156,26 +162,28 @@ func TestQueryCommitsWithDocIDAndUpdate(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "height": int64(2), - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "height": int64(1), - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "height": int64(1), - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "height": int64(2), - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "height": int64(2), + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "height": int64(1), + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "height": int64(1), + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "height": int64(2), + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "height": int64(1), + }, }, }, }, @@ -217,47 +225,49 @@ func TestQueryCommitsWithDocIDAndUpdateAndLinks(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "links": []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "_head", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "links": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "_head", + }, }, }, - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "links": []map[string]any{}, - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "links": []map[string]any{}, - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", - "links": []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "name": "_head", - }, - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - "name": "age", - }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "links": []map[string]any{}, }, - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "links": []map[string]any{ - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "name": "name", + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "links": []map[string]any{}, + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + "links": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "name": "_head", + }, + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + "name": "age", + }, }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "age", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "links": []map[string]any{ + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "name": "name", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "age", + }, }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_typename_test.go b/tests/integration/query/commits/with_doc_id_typename_test.go index a26580d113..c825933d83 100644 --- a/tests/integration/query/commits/with_doc_id_typename_test.go +++ b/tests/integration/query/commits/with_doc_id_typename_test.go @@ -35,18 +35,20 @@ func TestQueryCommitsWithDocIDWithTypeName(t *testing.T) { __typename } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "__typename": "Commit", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "__typename": "Commit", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "__typename": "Commit", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "__typename": "Commit", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "__typename": "Commit", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "__typename": "Commit", + }, }, }, }, diff --git a/tests/integration/query/commits/with_field_test.go b/tests/integration/query/commits/with_field_test.go index 48c5225ca5..43d23c462c 100644 --- a/tests/integration/query/commits/with_field_test.go +++ b/tests/integration/query/commits/with_field_test.go @@ -36,7 +36,9 @@ func TestQueryCommitsWithField(t *testing.T) { cid } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "commits": []map[string]any{}, + }, }, }, } @@ -64,9 +66,11 @@ func TestQueryCommitsWithFieldId(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, }, }, }, @@ -96,9 +100,11 @@ func TestQueryCommitsWithCompositeFieldId(t *testing.T) { cid } }`, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -129,10 +135,12 @@ func TestQueryCommitsWithCompositeFieldIdWithReturnedSchemaVersionID(t *testing. schemaVersionId } }`, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + }, }, }, }, diff --git a/tests/integration/query/commits/with_group_test.go b/tests/integration/query/commits/with_group_test.go index 5405ea49c8..372097932c 100644 --- a/tests/integration/query/commits/with_group_test.go +++ b/tests/integration/query/commits/with_group_test.go @@ -41,12 +41,14 @@ func TestQueryCommitsWithGroupBy(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "height": int64(2), - }, - { - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "height": int64(2), + }, + { + "height": int64(1), + }, }, }, }, @@ -84,29 +86,31 @@ func TestQueryCommitsWithGroupByHeightWithChild(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "height": int64(2), - "_group": []map[string]any{ - { - "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", - }, - { - "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + Results: map[string]any{ + "commits": []map[string]any{ + { + "height": int64(2), + "_group": []map[string]any{ + { + "cid": "bafyreiay56ley5dvsptso37fsonfcrtbuphwlfhi67d2y52vzzexba6vua", + }, + { + "cid": "bafyreicsavx5oblk6asfoqyssz4ge2gf5ekfouvi7o6l7adly275op5oje", + }, }, }, - }, - { - "height": int64(1), - "_group": []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + { + "height": int64(1), + "_group": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + }, + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + }, + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + }, }, }, }, @@ -140,28 +144,30 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "_group": []map[string]any{ - { - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "_group": []map[string]any{ + { + "height": int64(1), + }, }, }, - }, - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "_group": []map[string]any{ - { - "height": int64(1), + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "_group": []map[string]any{ + { + "height": int64(1), + }, }, }, - }, - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "_group": []map[string]any{ - { - "height": int64(1), + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "_group": []map[string]any{ + { + "height": int64(1), + }, }, }, }, @@ -212,12 +218,14 @@ func TestQueryCommitsWithGroupByDocID(t *testing.T) { docID } }`, - Results: []map[string]any{ - { - "docID": "bae-a839588e-e2e5-5ede-bb91-ffe6871645cb", - }, - { - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + Results: map[string]any{ + "commits": []map[string]any{ + { + "docID": "bae-a839588e-e2e5-5ede-bb91-ffe6871645cb", + }, + { + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + }, }, }, }, @@ -252,15 +260,17 @@ func TestQueryCommitsWithGroupByFieldName(t *testing.T) { fieldName } }`, - Results: []map[string]any{ - { - "fieldName": "age", - }, - { - "fieldName": "name", - }, - { - "fieldName": nil, + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldName": "age", + }, + { + "fieldName": "name", + }, + { + "fieldName": nil, + }, }, }, }, @@ -298,34 +308,36 @@ func TestQueryCommitsWithGroupByFieldNameWithChild(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "fieldName": "age", - "_group": []map[string]any{ - { - "height": int64(2), - }, - { - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldName": "age", + "_group": []map[string]any{ + { + "height": int64(2), + }, + { + "height": int64(1), + }, }, }, - }, - { - "fieldName": "name", - "_group": []map[string]any{ - { - "height": int64(1), + { + "fieldName": "name", + "_group": []map[string]any{ + { + "height": int64(1), + }, }, }, - }, - { - "fieldName": nil, - "_group": []map[string]any{ - { - "height": int64(2), - }, - { - "height": int64(1), + { + "fieldName": nil, + "_group": []map[string]any{ + { + "height": int64(2), + }, + { + "height": int64(1), + }, }, }, }, @@ -362,15 +374,17 @@ func TestQueryCommitsWithGroupByFieldID(t *testing.T) { fieldId } }`, - Results: []map[string]any{ - { - "fieldId": "1", - }, - { - "fieldId": "2", - }, - { - "fieldId": "C", + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldId": "1", + }, + { + "fieldId": "2", + }, + { + "fieldId": "C", + }, }, }, }, @@ -408,34 +422,36 @@ func TestQueryCommitsWithGroupByFieldIDWithChild(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "fieldId": "1", - "_group": []map[string]any{ - { - "height": int64(2), - }, - { - "height": int64(1), + Results: map[string]any{ + "commits": []map[string]any{ + { + "fieldId": "1", + "_group": []map[string]any{ + { + "height": int64(2), + }, + { + "height": int64(1), + }, }, }, - }, - { - "fieldId": "2", - "_group": []map[string]any{ - { - "height": int64(1), + { + "fieldId": "2", + "_group": []map[string]any{ + { + "height": int64(1), + }, }, }, - }, - { - "fieldId": "C", - "_group": []map[string]any{ - { - "height": int64(2), - }, - { - "height": int64(1), + { + "fieldId": "C", + "_group": []map[string]any{ + { + "height": int64(2), + }, + { + "height": int64(1), + }, }, }, }, diff --git a/tests/integration/query/inline_array/simple_test.go b/tests/integration/query/inline_array/simple_test.go index 16ade304fb..f266b114ba 100644 --- a/tests/integration/query/inline_array/simple_test.go +++ b/tests/integration/query/inline_array/simple_test.go @@ -36,10 +36,12 @@ func TestQueryInlineArrayWithBooleans(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "likedIndexes": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "likedIndexes": nil, + }, }, }, }, @@ -59,10 +61,12 @@ func TestQueryInlineArrayWithBooleans(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "likedIndexes": []bool{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "likedIndexes": []bool{}, + }, }, }, }, @@ -82,10 +86,12 @@ func TestQueryInlineArrayWithBooleans(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "likedIndexes": []bool{true, true, false, true}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "likedIndexes": []bool{true, true, false, true}, + }, }, }, }, @@ -113,14 +119,16 @@ func TestQueryInlineArrayWithNillableBooleans(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "indexLikesDislikes": []immutable.Option[bool]{ - immutable.Some(true), - immutable.Some(true), - immutable.Some(false), - immutable.None[bool](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "indexLikesDislikes": []immutable.Option[bool]{ + immutable.Some(true), + immutable.Some(true), + immutable.Some(false), + immutable.None[bool](), + }, }, }, }, @@ -146,10 +154,12 @@ func TestQueryInlineArrayWithIntegers(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteIntegers": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteIntegers": nil, + }, }, }, }, @@ -169,10 +179,12 @@ func TestQueryInlineArrayWithIntegers(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteIntegers": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteIntegers": nil, + }, }, }, }, @@ -192,10 +204,12 @@ func TestQueryInlineArrayWithIntegers(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteIntegers": []int64{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteIntegers": []int64{}, + }, }, }, }, @@ -215,10 +229,12 @@ func TestQueryInlineArrayWithIntegers(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteIntegers": []int64{1, 2, 3, 5, 8}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteIntegers": []int64{1, 2, 3, 5, 8}, + }, }, }, }, @@ -238,10 +254,12 @@ func TestQueryInlineArrayWithIntegers(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Andy", - "favouriteIntegers": []int64{-1, -2, -3, -5, -8}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Andy", + "favouriteIntegers": []int64{-1, -2, -3, -5, -8}, + }, }, }, }, @@ -261,10 +279,12 @@ func TestQueryInlineArrayWithIntegers(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, + }, }, }, }, @@ -292,15 +312,17 @@ func TestQueryInlineArrayWithNillableInts(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "testScores": []immutable.Option[int64]{ - immutable.Some[int64](-1), - immutable.None[int64](), - immutable.Some[int64](-1), - immutable.Some[int64](2), - immutable.Some[int64](0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "testScores": []immutable.Option[int64]{ + immutable.Some[int64](-1), + immutable.None[int64](), + immutable.Some[int64](-1), + immutable.Some[int64](2), + immutable.Some[int64](0), + }, }, }, }, @@ -327,10 +349,12 @@ func TestQueryInlineArrayWithFloats(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteFloats": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteFloats": nil, + }, }, }, }, @@ -350,10 +374,12 @@ func TestQueryInlineArrayWithFloats(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteFloats": []float64{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteFloats": []float64{}, + }, }, }, }, @@ -373,10 +399,12 @@ func TestQueryInlineArrayWithFloats(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "favouriteFloats": []float64{3.1425, 0.00000000001, 10}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "favouriteFloats": []float64{3.1425, 0.00000000001, 10}, + }, }, }, }, @@ -404,14 +432,16 @@ func TestQueryInlineArrayWithNillableFloats(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "pageRatings": []immutable.Option[float64]{ - immutable.Some(3.1425), - immutable.None[float64](), - immutable.Some(-0.00000000001), - immutable.Some[float64](10), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "pageRatings": []immutable.Option[float64]{ + immutable.Some(3.1425), + immutable.None[float64](), + immutable.Some(-0.00000000001), + immutable.Some[float64](10), + }, }, }, }, @@ -438,10 +468,12 @@ func TestQueryInlineArrayWithStrings(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "preferredStrings": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "preferredStrings": nil, + }, }, }, }, @@ -461,10 +493,12 @@ func TestQueryInlineArrayWithStrings(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "preferredStrings": []string{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "preferredStrings": []string{}, + }, }, }, }, @@ -484,10 +518,12 @@ func TestQueryInlineArrayWithStrings(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "preferredStrings": []string{"", "the previous", "the first", "empty string"}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "preferredStrings": []string{"", "the previous", "the first", "empty string"}, + }, }, }, }, @@ -515,15 +551,17 @@ func TestQueryInlineArrayWithNillableString(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "pageHeaders": []immutable.Option[string]{ - immutable.Some(""), - immutable.Some("the previous"), - immutable.Some("the first"), - immutable.Some("empty string"), - immutable.None[string](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "pageHeaders": []immutable.Option[string]{ + immutable.Some(""), + immutable.Some("the previous"), + immutable.Some("the first"), + immutable.Some("empty string"), + immutable.None[string](), + }, }, }, }, diff --git a/tests/integration/query/inline_array/with_average_filter_test.go b/tests/integration/query/inline_array/with_average_filter_test.go index f42c40922f..cac50ea81c 100644 --- a/tests/integration/query/inline_array/with_average_filter_test.go +++ b/tests/integration/query/inline_array/with_average_filter_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithAverageWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_avg": float64(1.5), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_avg": float64(1.5), + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineNillableIntegerArrayWithAverageWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(6.5), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(6.5), + }, }, }, } @@ -89,10 +93,12 @@ func TestQueryInlineFloatArrayWithAverageWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_avg": 3.5, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_avg": 3.5, + }, }, }, } @@ -117,10 +123,12 @@ func TestQueryInlineNillableFloatArrayWithAverageWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_avg": 3.5, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_avg": 3.5, + }, }, }, } diff --git a/tests/integration/query/inline_array/with_average_sum_test.go b/tests/integration/query/inline_array/with_average_sum_test.go index 56bc5da3a8..a6474d8f03 100644 --- a/tests/integration/query/inline_array/with_average_sum_test.go +++ b/tests/integration/query/inline_array/with_average_sum_test.go @@ -38,11 +38,13 @@ func TestQueryInlineIntegerArrayWithAverageAndSum(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(2), - "_sum": int64(8), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(2), + "_sum": int64(8), + }, }, }, } diff --git a/tests/integration/query/inline_array/with_average_test.go b/tests/integration/query/inline_array/with_average_test.go index c1e62c61bb..bd5eeec041 100644 --- a/tests/integration/query/inline_array/with_average_test.go +++ b/tests/integration/query/inline_array/with_average_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithAverageAndNullArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0), + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineIntegerArrayWithAverageAndEmptyArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0), + }, }, }, } @@ -89,10 +93,12 @@ func TestQueryInlineIntegerArrayWithAverageAndZeroArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0), + }, }, }, } @@ -117,10 +123,12 @@ func TestQueryInlineIntegerArrayWithAverageAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(2), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(2), + }, }, }, } @@ -145,10 +153,12 @@ func TestQueryInlineNillableIntegerArrayWithAverageAndPopulatedArray(t *testing. }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(4), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(4), + }, }, }, } @@ -173,10 +183,12 @@ func TestQueryInlineFloatArrayWithAverageAndNullArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0), + }, }, }, } @@ -201,10 +213,12 @@ func TestQueryInlineFloatArrayWithAverageAndEmptyArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0), + }, }, }, } @@ -229,10 +243,13 @@ func TestQueryInlineFloatArrayWithAverageAndZeroArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + + "name": "John", + "_avg": float64(0), + }, }, }, } @@ -257,10 +274,12 @@ func TestQueryInlineFloatArrayWithAverageAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0.2), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0.2), + }, }, }, } @@ -285,10 +304,12 @@ func TestQueryInlineNillableFloatArrayWithAverageAndPopulatedArray(t *testing.T) }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_avg": float64(0.2), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_avg": float64(0.2), + }, }, }, } diff --git a/tests/integration/query/inline_array/with_count_filter_test.go b/tests/integration/query/inline_array/with_count_filter_test.go index 69cd847d23..c8c81f82e2 100644 --- a/tests/integration/query/inline_array/with_count_filter_test.go +++ b/tests/integration/query/inline_array/with_count_filter_test.go @@ -33,10 +33,12 @@ func TestQueryInlineBoolArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 3, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 3, + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineNillableBoolArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_count": 2, + }, }, }, } @@ -89,10 +93,12 @@ func TestQueryInlineIntegerArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -117,10 +123,12 @@ func TestQueryInlineNillableIntegerArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -144,10 +152,12 @@ func TestQueryInlineIntegerArrayWithsWithCountWithAndFilterAndPopulatedArray(t * "favouriteIntegers": [-1, 2, -1, 1, 0, -2] }`)}, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 4, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 4, + }, }, }, } @@ -172,10 +182,12 @@ func TestQueryInlineFloatArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -200,10 +212,12 @@ func TestQueryInlineNillableFloatArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -228,10 +242,12 @@ func TestQueryInlineStringArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -256,10 +272,12 @@ func TestQueryInlineNillableStringArrayWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } diff --git a/tests/integration/query/inline_array/with_count_limit_offset_test.go b/tests/integration/query/inline_array/with_count_limit_offset_test.go index 59783e9587..d1e04b43ed 100644 --- a/tests/integration/query/inline_array/with_count_limit_offset_test.go +++ b/tests/integration/query/inline_array/with_count_limit_offset_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithCountWithOffsetWithLimitGreaterThanLength(t }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineIntegerArrayWithCountWithOffsetWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 3, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 3, + }, }, }, } diff --git a/tests/integration/query/inline_array/with_count_limit_test.go b/tests/integration/query/inline_array/with_count_limit_test.go index b29c62e8e7..09354ecc8c 100644 --- a/tests/integration/query/inline_array/with_count_limit_test.go +++ b/tests/integration/query/inline_array/with_count_limit_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithCountWithLimitGreaterThanLength(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 2, + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineIntegerArrayWithCountWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 3, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 3, + }, }, }, } diff --git a/tests/integration/query/inline_array/with_count_test.go b/tests/integration/query/inline_array/with_count_test.go index 18e7aaed69..40401e1cce 100644 --- a/tests/integration/query/inline_array/with_count_test.go +++ b/tests/integration/query/inline_array/with_count_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithCountAndNullArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_count": 0, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_count": 0, + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineIntegerArrayWithCountAndEmptyArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_count": 0, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_count": 0, + }, }, }, } @@ -89,10 +93,12 @@ func TestQueryInlineIntegerArrayWithCountAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_count": 5, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_count": 5, + }, }, }, } @@ -117,10 +123,12 @@ func TestQueryInlineNillableBoolArrayWithCountAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_count": 4, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_count": 4, + }, }, }, } diff --git a/tests/integration/query/inline_array/with_group_test.go b/tests/integration/query/inline_array/with_group_test.go index 8ab6eb356e..7706b9250b 100644 --- a/tests/integration/query/inline_array/with_group_test.go +++ b/tests/integration/query/inline_array/with_group_test.go @@ -39,15 +39,17 @@ func TestQueryInlineArrayWithGroupByString(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_group": []map[string]any{ - { - "favouriteIntegers": []int64{1, -2, 1, -1, 0}, - }, - { - "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_group": []map[string]any{ + { + "favouriteIntegers": []int64{1, -2, 1, -1, 0}, + }, + { + "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, + }, }, }, }, @@ -84,24 +86,26 @@ func TestQueryInlineArrayWithGroupByArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "favouriteIntegers": []int64{1, 2, 3}, - "_group": []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "favouriteIntegers": []int64{1, 2, 3}, + "_group": []map[string]any{ + { + "name": "John", + }, }, }, - }, - { - "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, - "_group": []map[string]any{ - { - "name": "Andy", - }, - { + { + "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, + "_group": []map[string]any{ + { + "name": "Andy", + }, + { - "name": "Shahzad", + "name": "Shahzad", + }, }, }, }, diff --git a/tests/integration/query/inline_array/with_sum_filter_test.go b/tests/integration/query/inline_array/with_sum_filter_test.go index 85cd56842b..075411e06a 100644 --- a/tests/integration/query/inline_array/with_sum_filter_test.go +++ b/tests/integration/query/inline_array/with_sum_filter_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithSumWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": int64(3), + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineNillableIntegerArrayWithSumWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": int64(3), + }, }, }, } @@ -89,10 +93,12 @@ func TestQueryInlineFloatArrayWithSumWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": 3.14250000001, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": 3.14250000001, + }, }, }, } @@ -117,10 +123,12 @@ func TestQueryInlineNillableFloatArrayWithSumWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": float64(3.14250000001), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": float64(3.14250000001), + }, }, }, } diff --git a/tests/integration/query/inline_array/with_sum_limit_offset_order_test.go b/tests/integration/query/inline_array/with_sum_limit_offset_order_test.go index c23f4352fe..59e4ddc7fd 100644 --- a/tests/integration/query/inline_array/with_sum_limit_offset_order_test.go +++ b/tests/integration/query/inline_array/with_sum_limit_offset_order_test.go @@ -33,11 +33,13 @@ func TestQueryInlineIntegerArrayWithSumWithOffsetWithLimitWithOrderAsc(t *testin }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 0 + 1 + 2 - "_sum": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 0 + 1 + 2 + "_sum": int64(3), + }, }, }, } @@ -62,11 +64,13 @@ func TestQueryInlineIntegerArrayWithSumWithOffsetWithLimitWithOrderDesc(t *testi }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 5 + 2 + 1 - "_sum": int64(8), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 5 + 2 + 1 + "_sum": int64(8), + }, }, }, } @@ -91,11 +95,13 @@ func TestQueryInlineNillableIntegerArrayWithSumWithOffsetWithLimitWithOrderAsc(t }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 0 + 1 + 2 - "_sum": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 0 + 1 + 2 + "_sum": int64(3), + }, }, }, } @@ -120,11 +126,13 @@ func TestQueryInlineNillableIntegerArrayWithSumWithOffsetWithLimitWithOrderDesc( }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 5 + 2 + 1 - "_sum": int64(8), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 5 + 2 + 1 + "_sum": int64(8), + }, }, }, } @@ -149,11 +157,13 @@ func TestQueryInlineFloatArrayWithSumWithOffsetWithLimitWithOrderAsc(t *testing. }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 0.577 + 2.718 + 3.1425 - "_sum": float64(6.4375), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 0.577 + 2.718 + 3.1425 + "_sum": float64(6.4375), + }, }, }, } @@ -178,11 +188,13 @@ func TestQueryInlineFloatArrayWithSumWithOffsetWithLimitWithOrderDesc(t *testing }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 6.283 + 3.1425 + 2.718 - "_sum": float64(12.1435), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 6.283 + 3.1425 + 2.718 + "_sum": float64(12.1435), + }, }, }, } @@ -207,11 +219,13 @@ func TestQueryInlineNillableFloatArrayWithSumWithOffsetWithLimitWithOrderAsc(t * }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 0.577 + 2.718 + 3.1425 - "_sum": float64(6.4375), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 0.577 + 2.718 + 3.1425 + "_sum": float64(6.4375), + }, }, }, } @@ -236,11 +250,13 @@ func TestQueryInlineNillableFloatArrayWithSumWithOffsetWithLimitWithOrderDesc(t }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - // 6.283 + 3.1425 + 2.718 - "_sum": float64(12.1435), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + // 6.283 + 3.1425 + 2.718 + "_sum": float64(12.1435), + }, }, }, } diff --git a/tests/integration/query/inline_array/with_sum_limit_offset_test.go b/tests/integration/query/inline_array/with_sum_limit_offset_test.go index 6e4d4ef3d7..357dbbde7e 100644 --- a/tests/integration/query/inline_array/with_sum_limit_offset_test.go +++ b/tests/integration/query/inline_array/with_sum_limit_offset_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithSumWithOffsetWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": int64(7), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": int64(7), + }, }, }, } diff --git a/tests/integration/query/inline_array/with_sum_limit_test.go b/tests/integration/query/inline_array/with_sum_limit_test.go index 2cf9104bbc..79ebd60f36 100644 --- a/tests/integration/query/inline_array/with_sum_limit_test.go +++ b/tests/integration/query/inline_array/with_sum_limit_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithSumWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": int64(1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": int64(1), + }, }, }, } diff --git a/tests/integration/query/inline_array/with_sum_test.go b/tests/integration/query/inline_array/with_sum_test.go index 35db82a41a..28f63bb6b3 100644 --- a/tests/integration/query/inline_array/with_sum_test.go +++ b/tests/integration/query/inline_array/with_sum_test.go @@ -33,10 +33,12 @@ func TestQueryInlineIntegerArrayWithSumAndNullArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_sum": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_sum": int64(0), + }, }, }, } @@ -61,10 +63,12 @@ func TestQueryInlineIntegerArrayWithSumAndEmptyArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_sum": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_sum": int64(0), + }, }, }, } @@ -89,10 +93,12 @@ func TestQueryInlineIntegerArrayWithSumAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": int64(1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": int64(1), + }, }, }, } @@ -117,10 +123,12 @@ func TestQueryInlineNillableIntegerArrayWithSumAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": int64(2), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": int64(2), + }, }, }, } @@ -145,10 +153,12 @@ func TestQueryInlineFloatArrayWithSumAndNullArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_sum": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_sum": float64(0), + }, }, }, } @@ -173,10 +183,12 @@ func TestQueryInlineFloatArrayWithSumAndEmptyArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_sum": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_sum": float64(0), + }, }, }, } @@ -201,10 +213,12 @@ func TestQueryInlineFloatArrayWithSumAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John", - "_sum": float64(13.14250000001), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_sum": float64(13.14250000001), + }, }, }, } @@ -229,10 +243,12 @@ func TestQueryInlineNillableFloatArrayWithSumAndPopulatedArray(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Shahzad", - "_sum": float64(13.14250000001), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "_sum": float64(13.14250000001), + }, }, }, } diff --git a/tests/integration/query/latest_commits/with_collectionid_prop_test.go b/tests/integration/query/latest_commits/with_collectionid_prop_test.go index 5509671aef..ae0758f6c2 100644 --- a/tests/integration/query/latest_commits/with_collectionid_prop_test.go +++ b/tests/integration/query/latest_commits/with_collectionid_prop_test.go @@ -41,9 +41,11 @@ func TestQueryLastCommitsWithCollectionIdProperty(t *testing.T) { collectionID } }`, - Results: []map[string]any{ - { - "collectionID": int64(1), + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "collectionID": int64(1), + }, }, }, }, @@ -53,9 +55,11 @@ func TestQueryLastCommitsWithCollectionIdProperty(t *testing.T) { collectionID } }`, - Results: []map[string]any{ - { - "collectionID": int64(2), + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "collectionID": int64(2), + }, }, }, }, diff --git a/tests/integration/query/latest_commits/with_doc_id_field_test.go b/tests/integration/query/latest_commits/with_doc_id_field_test.go index 04f0065b0a..bdaf4d5562 100644 --- a/tests/integration/query/latest_commits/with_doc_id_field_test.go +++ b/tests/integration/query/latest_commits/with_doc_id_field_test.go @@ -38,7 +38,9 @@ func TestQueryLatestCommitsWithDocIDAndFieldName(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "latestCommits": []map[string]any{}, + }, } executeTestCase(t, test) @@ -66,10 +68,12 @@ func TestQueryLatestCommitsWithDocIDAndFieldId(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "links": []map[string]any{}, + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "links": []map[string]any{}, + }, }, }, } @@ -99,17 +103,19 @@ func TestQueryLatestCommitsWithDocIDAndCompositeFieldId(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "links": []map[string]any{ - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "name": "name", - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "age", + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "links": []map[string]any{ + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "name": "name", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "age", + }, }, }, }, diff --git a/tests/integration/query/latest_commits/with_doc_id_prop_test.go b/tests/integration/query/latest_commits/with_doc_id_prop_test.go index 5cef0f2d06..652d321973 100644 --- a/tests/integration/query/latest_commits/with_doc_id_prop_test.go +++ b/tests/integration/query/latest_commits/with_doc_id_prop_test.go @@ -34,9 +34,11 @@ func TestQueryLastCommitsWithDocIDProperty(t *testing.T) { docID } }`, - Results: []map[string]any{ - { - "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + }, }, }, }, diff --git a/tests/integration/query/latest_commits/with_doc_id_test.go b/tests/integration/query/latest_commits/with_doc_id_test.go index d39becb3d3..4bd51d546d 100644 --- a/tests/integration/query/latest_commits/with_doc_id_test.go +++ b/tests/integration/query/latest_commits/with_doc_id_test.go @@ -36,17 +36,19 @@ func TestQueryLatestCommitsWithDocID(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "links": []map[string]any{ - { - "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", - "name": "name", - }, - { - "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", - "name": "age", + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "links": []map[string]any{ + { + "cid": "bafyreic2sba5sffkfnt32wfeoaw4qsqozjb5acwwtouxuzllb3aymjwute", + "name": "name", + }, + { + "cid": "bafyreifzyy7bmpx2eywj4lznxzrzrvh6vrz6l7bhthkpexdq3wtho3vz6i", + "name": "age", + }, }, }, }, @@ -73,10 +75,12 @@ func TestQueryLatestCommitsWithDocIDWithSchemaVersionIDField(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", - "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + Results: map[string]any{ + "latestCommits": []map[string]any{ + { + "cid": "bafyreihv7jqe32wsuff5vwzlp7izoo6pqg6kgqf5edknp3mqm3344gu35q", + "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", + }, }, }, } diff --git a/tests/integration/query/one_to_many/simple_test.go b/tests/integration/query/one_to_many/simple_test.go index bf80618d83..44ee5f8cf5 100644 --- a/tests/integration/query/one_to_many/simple_test.go +++ b/tests/integration/query/one_to_many/simple_test.go @@ -48,13 +48,15 @@ func TestQueryOneToMany(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -106,28 +108,30 @@ func TestQueryOneToMany(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "age": int64(62), - "published": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "published": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, }, - }, - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, @@ -163,11 +167,13 @@ func TestQueryOneToManyWithNonExistantParent(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": nil, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": nil, + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_cid_doc_id_test.go b/tests/integration/query/one_to_many/with_cid_doc_id_test.go index 3f415ab288..91f2d5782b 100644 --- a/tests/integration/query/one_to_many/with_cid_doc_id_test.go +++ b/tests/integration/query/one_to_many/with_cid_doc_id_test.go @@ -113,11 +113,13 @@ func TestQueryOneToManyWithCidAndDocID(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -189,12 +191,14 @@ func TestQueryOneToManyWithChildUpdateAndFirstCidAndDocID(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", - "age": int64(22), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + "age": int64(22), + }, }, }, }, @@ -262,12 +266,14 @@ func TestQueryOneToManyWithParentUpdateAndFirstCidAndDocID(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": float64(4.9), - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": float64(4.9), + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -335,12 +341,14 @@ func TestQueryOneToManyWithParentUpdateAndLastCidAndDocID(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": float64(4.5), - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": float64(4.5), + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_count_filter_test.go b/tests/integration/query/one_to_many/with_count_filter_test.go index 4d1a590479..261e5993e9 100644 --- a/tests/integration/query/one_to_many/with_count_filter_test.go +++ b/tests/integration/query/one_to_many/with_count_filter_test.go @@ -60,14 +60,16 @@ func TestQueryOneToManyWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 0, - }, - { - "name": "John Grisham", - "_count": 1, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 0, + }, + { + "name": "John Grisham", + "_count": 1, + }, }, }, } @@ -126,25 +128,27 @@ func TestQueryOneToManyWithCountWithFilterAndChildFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 1, - "published": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + "published": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - }, - { - "name": "John Grisham", - "_count": 2, - "published": []map[string]any{ - { - "name": "Painted House", - }, - { - "name": "A Time for Mercy", + { + "name": "John Grisham", + "_count": 2, + "published": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "A Time for Mercy", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_count_limit_offset_test.go b/tests/integration/query/one_to_many/with_count_limit_offset_test.go index 838f67434d..eea8a504c7 100644 --- a/tests/integration/query/one_to_many/with_count_limit_offset_test.go +++ b/tests/integration/query/one_to_many/with_count_limit_offset_test.go @@ -73,21 +73,23 @@ func TestQueryOneToManyWithCountAndLimitAndOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 1, - "published": []map[string]any{}, - }, - { - "name": "John Grisham", - "_count": 4, - "published": []map[string]any{ - { - "name": "Painted House", - }, - { - "name": "The Pelican Brief", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + "published": []map[string]any{}, + }, + { + "name": "John Grisham", + "_count": 4, + "published": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "The Pelican Brief", + }, }, }, }, @@ -149,25 +151,27 @@ func TestQueryOneToManyWithCountAndDifferentOffsets(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 0, - "published": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 0, + "published": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - }, - { - "name": "John Grisham", - "_count": 2, - "published": []map[string]any{ - { - "name": "The Associate", - }, - { - "name": "Painted House", + { + "name": "John Grisham", + "_count": 2, + "published": []map[string]any{ + { + "name": "The Associate", + }, + { + "name": "Painted House", + }, }, }, }, @@ -221,14 +225,16 @@ func TestQueryOneToManyWithCountWithLimitWithOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 0, - }, - { - "name": "John Grisham", - "_count": 1, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 0, + }, + { + "name": "John Grisham", + "_count": 1, + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_count_limit_test.go b/tests/integration/query/one_to_many/with_count_limit_test.go index 3badad8ef8..3f7006d074 100644 --- a/tests/integration/query/one_to_many/with_count_limit_test.go +++ b/tests/integration/query/one_to_many/with_count_limit_test.go @@ -63,22 +63,24 @@ func TestQueryOneToManyWithCountAndLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 1, - "published": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + "published": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - }, - { - "name": "John Grisham", - "_count": 2, - "published": []map[string]any{ - { - "name": "Painted House", + { + "name": "John Grisham", + "_count": 2, + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -140,22 +142,24 @@ func TestQueryOneToManyWithCountAndDifferentLimits(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 1, - "published": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + "published": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - }, - { - "name": "John Grisham", - "_count": 2, - "published": []map[string]any{ - { - "name": "The Associate", + { + "name": "John Grisham", + "_count": 2, + "published": []map[string]any{ + { + "name": "The Associate", + }, }, }, }, @@ -209,14 +213,16 @@ func TestQueryOneToManyWithCountWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 1, - }, - { - "name": "John Grisham", - "_count": 1, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + }, + { + "name": "John Grisham", + "_count": 1, + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_count_test.go b/tests/integration/query/one_to_many/with_count_test.go index 0efb541d85..dba62fbf05 100644 --- a/tests/integration/query/one_to_many/with_count_test.go +++ b/tests/integration/query/one_to_many/with_count_test.go @@ -36,10 +36,12 @@ func TestQueryOneToManyWithCount(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 0, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "_count": 0, + }, }, }, }, @@ -86,14 +88,16 @@ func TestQueryOneToManyWithCount(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 1, - }, - { - "name": "John Grisham", - "_count": 2, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + }, + { + "name": "John Grisham", + "_count": 2, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_doc_id_test.go b/tests/integration/query/one_to_many/with_doc_id_test.go index e6e6aa9b90..b00fd0a549 100644 --- a/tests/integration/query/one_to_many/with_doc_id_test.go +++ b/tests/integration/query/one_to_many/with_doc_id_test.go @@ -52,12 +52,14 @@ func TestQueryOneToManyWithChildDocID(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_doc_ids_test.go b/tests/integration/query/one_to_many/with_doc_ids_test.go index 6e61902c79..998c926909 100644 --- a/tests/integration/query/one_to_many/with_doc_ids_test.go +++ b/tests/integration/query/one_to_many/with_doc_ids_test.go @@ -64,15 +64,17 @@ func TestQueryOneToManyWithChildDocIDs(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "The Associate", - }, - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "The Associate", + }, + { + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_filter_related_id_test.go b/tests/integration/query/one_to_many/with_filter_related_id_test.go index f2e456143c..6d8508e3c3 100644 --- a/tests/integration/query/one_to_many/with_filter_related_id_test.go +++ b/tests/integration/query/one_to_many/with_filter_related_id_test.go @@ -83,10 +83,12 @@ func TestQueryFromManySideWithEqFilterOnRelatedType(t *testing.T) { }`, }, }, - Results: []map[string]any{ - {"name": "The Client"}, - {"name": "Painted House"}, - {"name": "A Time for Mercy"}, + Results: map[string]any{ + "Book": []map[string]any{ + {"name": "The Client"}, + {"name": "Painted House"}, + {"name": "A Time for Mercy"}, + }, }, } @@ -160,10 +162,12 @@ func TestQueryFromManySideWithFilterOnRelatedObjectID(t *testing.T) { }`, }, }, - Results: []map[string]any{ - {"name": "The Client"}, - {"name": "Painted House"}, - {"name": "A Time for Mercy"}, + Results: map[string]any{ + "Book": []map[string]any{ + {"name": "The Client"}, + {"name": "Painted House"}, + {"name": "A Time for Mercy"}, + }, }, } @@ -242,10 +246,12 @@ func TestQueryFromManySideWithSameFiltersInDifferentWayOnRelatedType(t *testing. }`, }, }, - Results: []map[string]any{ - {"name": "The Client"}, - {"name": "Painted House"}, - {"name": "A Time for Mercy"}, + Results: map[string]any{ + "Book": []map[string]any{ + {"name": "The Client"}, + {"name": "Painted House"}, + {"name": "A Time for Mercy"}, + }, }, } @@ -319,9 +325,11 @@ func TestQueryFromSingleSideWithEqFilterOnRelatedType(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_filter_test.go b/tests/integration/query/one_to_many/with_filter_test.go index 94c971c7a8..317d89b2fd 100644 --- a/tests/integration/query/one_to_many/with_filter_test.go +++ b/tests/integration/query/one_to_many/with_filter_test.go @@ -77,18 +77,20 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParent(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, @@ -156,9 +158,11 @@ func TestQueryOneToManyWithNumericGreaterThanChildFilterOnParentWithUnrenderedCh name } }`, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, }, @@ -229,14 +233,16 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndChild(t *testing.T } } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, }, }, @@ -313,31 +319,33 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "age": int64(62), - "p1": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "p1": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, + "p2": []map[string]any{}, }, - "p2": []map[string]any{}, - }, - { - "name": "John Grisham", - "age": int64(65), - "p1": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + { + "name": "John Grisham", + "age": int64(65), + "p1": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, - }, - "p2": []map[string]any{ - { - "name": "A Time for Mercy", - "rating": 4.5, + "p2": []map[string]any{ + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, @@ -430,12 +438,14 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - }, - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + }, + { + "name": "John Grisham", + }, }, }, }, @@ -448,9 +458,11 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { name } }`, - Results: []map[string]any{{ - "name": "Cornelia Funke", - }}, + Results: map[string]any{ + "Author": []map[string]any{ + {"name": "Cornelia Funke"}, + }, + }, }, }, } @@ -535,12 +547,14 @@ func TestQueryOneToMany_WithCompoundOperatorInFilterAndRelationAndCaseInsensitiv name } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - }, - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + }, + { + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_group_filter_test.go b/tests/integration/query/one_to_many/with_group_filter_test.go index 6005ef2def..38deb0cc20 100644 --- a/tests/integration/query/one_to_many/with_group_filter_test.go +++ b/tests/integration/query/one_to_many/with_group_filter_test.go @@ -88,38 +88,40 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnJoin(t *testing }`, }, }, - Results: []map[string]any{ - { - "age": int64(327), - "_group": []map[string]any{ - { - "name": "Voltaire", - "published": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - }, - { - "name": "Zadig", - "rating": 4.91, + Results: map[string]any{ + "Author": []map[string]any{ + { + "age": int64(327), + "_group": []map[string]any{ + { + "name": "Voltaire", + "published": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + }, + { + "name": "Zadig", + "rating": 4.91, + }, }, }, - }, - { - "name": "Simon Pelloutier", - "published": []map[string]any{}, + { + "name": "Simon Pelloutier", + "published": []map[string]any{}, + }, }, }, - }, - { - "age": int64(65), - "_group": []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + { + "age": int64(65), + "_group": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, }, }, @@ -206,42 +208,44 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnGroup(t *testin }`, }, }, - Results: []map[string]any{ - { - "age": int64(327), - "_group": []map[string]any{ - { - "name": "Voltaire", - "published": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - }, - { - "name": "Zadig", - "rating": 4.91, + Results: map[string]any{ + "Author": []map[string]any{ + { + "age": int64(327), + "_group": []map[string]any{ + { + "name": "Voltaire", + "published": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + }, + { + "name": "Zadig", + "rating": 4.91, + }, }, }, }, }, - }, - { - "age": int64(65), - "_group": []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - }, - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + { + "age": int64(65), + "_group": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + }, + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, @@ -328,22 +332,24 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnGroupAndOnGroup }`, }, }, - Results: []map[string]any{ - { - "age": int64(327), - "_group": []map[string]any{ - { - "name": "Voltaire", - "published": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, + Results: map[string]any{ + "Author": []map[string]any{ + { + "age": int64(327), + "_group": []map[string]any{ + { + "name": "Voltaire", + "published": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + }, }, }, - }, - { - "name": "Simon Pelloutier", - "published": []map[string]any{}, + { + "name": "Simon Pelloutier", + "published": []map[string]any{}, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_group_related_id_alias_test.go b/tests/integration/query/one_to_many/with_group_related_id_alias_test.go index fdd50743c4..9dde09334d 100644 --- a/tests/integration/query/one_to_many/with_group_related_id_alias_test.go +++ b/tests/integration/query/one_to_many/with_group_related_id_alias_test.go @@ -122,66 +122,68 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromManySideUsingAlias(t *t } } }`, - Results: []map[string]any{ - { - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, }, }, - }, - { - "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - "_group": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + { + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, }, }, }, - }, - { - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, }, }, @@ -303,75 +305,77 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromManySideUsingAliasAndRe } } }`, - Results: []map[string]any{ - { - "author": map[string]any{ - "name": "John Grisham", - "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - }, - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", - }, + Results: map[string]any{ + "Book": []map[string]any{ + { + "author": map[string]any{ + "name": "John Grisham", + "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, }, }, - }, - { - "author": map[string]any{ - "name": "Simon Pelloutier", - "_docID": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - }, - "_group": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + { + "author": map[string]any{ + "name": "Simon Pelloutier", + "_docID": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + }, + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, }, }, }, - }, - { - "author": map[string]any{ - "name": "Voltaire", - "_docID": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - }, - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, + { + "author": map[string]any{ + "name": "Voltaire", + "_docID": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, }, }, @@ -490,66 +494,68 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromManySide } } }`, - Results: []map[string]any{ - { - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, }, }, - }, - { - "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - "_group": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + { + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, }, }, }, - }, - { - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, }, }, @@ -672,78 +678,80 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromManySide } } }`, - Results: []map[string]any{ - { - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - "author": map[string]any{ - "name": "John Grisham", - "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - }, - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", - }, + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "author": map[string]any{ + "name": "John Grisham", + "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, }, }, - }, - { - "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - "author": map[string]any{ - "name": "Simon Pelloutier", - "_docID": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - }, - "_group": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + { + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "author": map[string]any{ + "name": "Simon Pelloutier", + "_docID": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + }, + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, }, }, }, - }, - { - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - "author": map[string]any{ - "name": "Voltaire", - "_docID": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - }, - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "author": map[string]any{ + "name": "Voltaire", + "_docID": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_group_related_id_test.go b/tests/integration/query/one_to_many/with_group_related_id_test.go index 509c38fc27..da3a1cac3f 100644 --- a/tests/integration/query/one_to_many/with_group_related_id_test.go +++ b/tests/integration/query/one_to_many/with_group_related_id_test.go @@ -88,66 +88,68 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDFromManySide(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, }, }, - }, - { - "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - "_group": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + { + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, }, }, }, - }, - { - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, }, }, @@ -230,66 +232,68 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDWithIDSelectionFromManySi }`, }, }, - Results: []map[string]any{ - { - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, }, }, }, - }, - { - "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - "_group": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + { + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, }, }, }, - }, - { - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_group_test.go b/tests/integration/query/one_to_many/with_group_test.go index 0cb74a4492..b1fe1034f8 100644 --- a/tests/integration/query/one_to_many/with_group_test.go +++ b/tests/integration/query/one_to_many/with_group_test.go @@ -72,41 +72,43 @@ func TestQueryOneToManyWithInnerJoinGroupNumber(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "age": int64(62), - "published": []map[string]any{ - { - "rating": 4.8, - "_group": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "published": []map[string]any{ + { + "rating": 4.8, + "_group": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, }, }, - }, - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "rating": 4.5, - "_group": []map[string]any{ - { - "name": "The Client", - }, - { - "name": "A Time for Mercy", + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "rating": 4.5, + "_group": []map[string]any{ + { + "name": "The Client", + }, + { + "name": "A Time for Mercy", + }, }, }, - }, - { - "rating": 4.9, - "_group": []map[string]any{ - { - "name": "Painted House", + { + "rating": 4.9, + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -192,51 +194,53 @@ func TestQueryOneToManyWithParentJoinGroupNumber(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "age": int64(327), - "_group": []map[string]any{ - { - "name": "Voltaire", - "published": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - }, - { - "name": "Zadig", - "rating": 4.91, + Results: map[string]any{ + "Author": []map[string]any{ + { + "age": int64(327), + "_group": []map[string]any{ + { + "name": "Voltaire", + "published": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + }, + { + "name": "Zadig", + "rating": 4.91, + }, }, }, - }, - { - "name": "Simon Pelloutier", - "published": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": float64(2), + { + "name": "Simon Pelloutier", + "published": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": float64(2), + }, }, }, }, }, - }, - { - "age": int64(65), - "_group": []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - }, - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + { + "age": int64(65), + "_group": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + }, + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_limit_test.go b/tests/integration/query/one_to_many/with_limit_test.go index 6b518de6e1..1cfbaf6d98 100644 --- a/tests/integration/query/one_to_many/with_limit_test.go +++ b/tests/integration/query/one_to_many/with_limit_test.go @@ -63,22 +63,24 @@ func TestQueryOneToManyWithSingleChildLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "published": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "published": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, }, - }, - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, }, }, @@ -139,38 +141,40 @@ func TestQueryOneToManyWithMultipleChildLimits(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "p1": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - }, - "p2": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "p1": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, - }, - }, - { - "name": "John Grisham", - "p1": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + "p2": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, }, - "p2": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + { + "name": "John Grisham", + "p1": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, - { - "name": "A Time for Mercy", - "rating": 4.5, + "p2": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_order_filter_limit_test.go b/tests/integration/query/one_to_many/with_order_filter_limit_test.go index 46c27c474e..d10fabb100 100644 --- a/tests/integration/query/one_to_many/with_order_filter_limit_test.go +++ b/tests/integration/query/one_to_many/with_order_filter_limit_test.go @@ -66,14 +66,16 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortAscendi }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "A Time for Mercy", - "rating": 4.5, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, @@ -133,14 +135,16 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortDescend }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_order_filter_test.go b/tests/integration/query/one_to_many/with_order_filter_test.go index 225d25a7f4..3aec1e6a73 100644 --- a/tests/integration/query/one_to_many/with_order_filter_test.go +++ b/tests/integration/query/one_to_many/with_order_filter_test.go @@ -66,18 +66,20 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortAscendi }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "A Time for Mercy", - "rating": 4.5, - }, - { - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "A Time for Mercy", + "rating": 4.5, + }, + { + "name": "Painted House", + "rating": 4.9, + }, }, }, }, @@ -135,28 +137,30 @@ func TestQueryOneToManyWithNumericGreaterThanFilterAndNumericSortDescendingOnChi }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "age": int64(62), - "published": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "published": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, }, - }, - { - "name": "John Grisham", - "age": int64(65), - "published": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + { + "name": "John Grisham", + "age": int64(65), + "published": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_related_id_test.go b/tests/integration/query/one_to_many/with_related_id_test.go index 8626ffddd9..c5955352b5 100644 --- a/tests/integration/query/one_to_many/with_related_id_test.go +++ b/tests/integration/query/one_to_many/with_related_id_test.go @@ -86,30 +86,32 @@ func TestQueryOneToManyWithRelatedTypeIDFromManySide(t *testing.T) { }, }, - Results: []map[string]any{ - { - "name": "The Client", - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - }, - { - "name": "Painted House", - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - }, - { - "name": "A Time for Mercy", - "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", - }, - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", - }, - { - "name": "Candide", - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", - }, - { - "name": "Zadig", - "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "The Client", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + }, + { + "name": "Painted House", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + }, + { + "name": "A Time for Mercy", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + }, + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + }, + { + "name": "Candide", + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + }, + { + "name": "Zadig", + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_same_field_name_test.go b/tests/integration/query/one_to_many/with_same_field_name_test.go index 10136ae529..fbe56099b5 100644 --- a/tests/integration/query/one_to_many/with_same_field_name_test.go +++ b/tests/integration/query/one_to_many/with_same_field_name_test.go @@ -59,11 +59,13 @@ func TestQueryOneToManyWithSameFieldName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "relationship1": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "relationship1": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -93,12 +95,14 @@ func TestQueryOneToManyWithSameFieldName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "relationship1": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "relationship1": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_sum_filter_order_test.go b/tests/integration/query/one_to_many/with_sum_filter_order_test.go index 96f2c14fc1..0c2fcc0b70 100644 --- a/tests/integration/query/one_to_many/with_sum_filter_order_test.go +++ b/tests/integration/query/one_to_many/with_sum_filter_order_test.go @@ -86,18 +86,20 @@ func TestOneToManyAscOrderAndFilterOnParentWithAggSumOnSubTypeField(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": 4.8, - }, - { - "name": "John Grisham", - "_sum": 20.8, - }, - { - "name": "Not a Writer", - "_sum": 0.0, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": 4.8, + }, + { + "name": "John Grisham", + "_sum": 20.8, + }, + { + "name": "Not a Writer", + "_sum": 0.0, + }, }, }, } @@ -175,18 +177,20 @@ func TestOneToManyDescOrderAndFilterOnParentWithAggSumOnSubTypeField(t *testing. }`, }, }, - Results: []map[string]any{ - { - "name": "Not a Writer", - "_sum": 0.0, - }, - { - "name": "John Grisham", - "_sum": 20.8, - }, - { - "name": "Cornelia Funke", - "_sum": 4.8, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "_sum": 0.0, + }, + { + "name": "John Grisham", + "_sum": 20.8, + }, + { + "name": "Cornelia Funke", + "_sum": 4.8, + }, }, }, } @@ -265,26 +269,28 @@ func TestOnetoManySumBySubTypeFieldAndSumBySybTypeFieldWithDescOrderingOnFieldWi }`, }, }, - Results: []map[string]any{ - { - "name": "Little Kid", - "sum1": 0.0, - "sum2": 0.0, - }, - { - "name": "Not a Writer", - "sum1": 0.0, - "sum2": 0.0, - }, - { - "name": "Cornelia Funke", - "sum1": 4.8, - "sum2": 4.8, - }, - { - "name": "John Grisham", - "sum1": 20.8, - "sum2": 4.9 + 4.5, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Little Kid", + "sum1": 0.0, + "sum2": 0.0, + }, + { + "name": "Not a Writer", + "sum1": 0.0, + "sum2": 0.0, + }, + { + "name": "Cornelia Funke", + "sum1": 4.8, + "sum2": 4.8, + }, + { + "name": "John Grisham", + "sum1": 20.8, + "sum2": 4.9 + 4.5, + }, }, }, } @@ -363,26 +369,28 @@ func TestOnetoManySumBySubTypeFieldAndSumBySybTypeFieldWithAscOrderingOnFieldWit }`, }, }, - Results: []map[string]any{ - { - "name": "Little Kid", - "sum1": 0.0, - "sum2": 0.0, - }, - { - "name": "Not a Writer", - "sum1": 0.0, - "sum2": 0.0, - }, - { - "name": "Cornelia Funke", - "sum1": 4.8, - "sum2": 4.8, - }, - { - "name": "John Grisham", - "sum1": 20.8, - "sum2": 4.0 + 3.2, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Little Kid", + "sum1": 0.0, + "sum2": 0.0, + }, + { + "name": "Not a Writer", + "sum1": 0.0, + "sum2": 0.0, + }, + { + "name": "Cornelia Funke", + "sum1": 4.8, + "sum2": 4.8, + }, + { + "name": "John Grisham", + "sum1": 20.8, + "sum2": 4.0 + 3.2, + }, }, }, } @@ -462,31 +470,33 @@ func TestOneToManyLimitAscOrderSumOfSubTypeAndLimitAscOrderFieldsOfSubtype(t *te }`, }, }, - Results: []map[string]any{ - { - "LimitOrderSum": 0.0, - "LimitOrderFields": []map[string]any{}, - }, - { - "LimitOrderSum": 0.0, - "LimitOrderFields": []map[string]any{}, - }, - { - "LimitOrderSum": 4.8, - "LimitOrderFields": []map[string]any{ - { - "name": "Theif Lord", - }, + Results: map[string]any{ + "Author": []map[string]any{ + { + "LimitOrderSum": 0.0, + "LimitOrderFields": []map[string]any{}, }, - }, - { - "LimitOrderSum": 3.2 + 4.0, - "LimitOrderFields": []map[string]any{ - { - "name": "Sooley", + { + "LimitOrderSum": 0.0, + "LimitOrderFields": []map[string]any{}, + }, + { + "LimitOrderSum": 4.8, + "LimitOrderFields": []map[string]any{ + { + "name": "Theif Lord", + }, }, - { - "name": "The Rooster Bar", + }, + { + "LimitOrderSum": 3.2 + 4.0, + "LimitOrderFields": []map[string]any{ + { + "name": "Sooley", + }, + { + "name": "The Rooster Bar", + }, }, }, }, @@ -568,31 +578,33 @@ func TestOneToManyLimitDescOrderSumOfSubTypeAndLimitAscOrderFieldsOfSubtype(t *t }`, }, }, - Results: []map[string]any{ - { - "LimitOrderSum": 0.0, - "LimitOrderFields": []map[string]any{}, - }, - { - "LimitOrderSum": 0.0, - "LimitOrderFields": []map[string]any{}, - }, - { - "LimitOrderSum": 4.8, - "LimitOrderFields": []map[string]any{ - { - "name": "Theif Lord", - }, + Results: map[string]any{ + "Author": []map[string]any{ + { + "LimitOrderSum": 0.0, + "LimitOrderFields": []map[string]any{}, }, - }, - { - "LimitOrderSum": 4.9 + 4.5, - "LimitOrderFields": []map[string]any{ - { - "name": "Painted House", + { + "LimitOrderSum": 0.0, + "LimitOrderFields": []map[string]any{}, + }, + { + "LimitOrderSum": 4.8, + "LimitOrderFields": []map[string]any{ + { + "name": "Theif Lord", + }, }, - { - "name": "A Time for Mercy", + }, + { + "LimitOrderSum": 4.9 + 4.5, + "LimitOrderFields": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "A Time for Mercy", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go b/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go index e7c4606071..91aacd889c 100644 --- a/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go +++ b/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go @@ -107,16 +107,18 @@ func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderAsc(t *testing.T) { _sum(published: {field: rating, offset: 1, limit: 2, order: {name: ASC}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": float64(0), - }, - { - "name": "John Grisham", - // 4.9 + 3.2 - // ...00001 is float math artifact - "_sum": 8.100000000000001, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": float64(0), + }, + { + "name": "John Grisham", + // 4.9 + 3.2 + // ...00001 is float math artifact + "_sum": 8.100000000000001, + }, }, }, }, @@ -217,15 +219,17 @@ func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderDesc(t *testing.T) { _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": float64(0), - }, - { - "name": "John Grisham", - // 4.2 + 3.2 - "_sum": 7.4, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": float64(0), + }, + { + "name": "John Grisham", + // 4.2 + 3.2 + "_sum": 7.4, + }, }, }, }, @@ -327,19 +331,21 @@ func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderAscAndDesc(t *testing. desc: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "asc": float64(0), - "desc": float64(0), - }, - { - "name": "John Grisham", - // 4.9 + 3.2 - // ...00001 is float math artifact - "asc": 8.100000000000001, - // 4.2 + 3.2 - "desc": 7.4, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "asc": float64(0), + "desc": float64(0), + }, + { + "name": "John Grisham", + // 4.9 + 3.2 + // ...00001 is float math artifact + "asc": 8.100000000000001, + // 4.2 + 3.2 + "desc": 7.4, + }, }, }, }, @@ -441,18 +447,20 @@ func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderOnDifferentFields(t *t byRating: _sum(published: {field: rating, offset: 1, limit: 2, order: {rating: DESC}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "byName": float64(0), - "byRating": float64(0), - }, - { - "name": "John Grisham", - // 4.2 + 3.2 - "byName": 7.4, - // 4.5 + 4.2 - "byRating": 8.7, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "byName": float64(0), + "byRating": float64(0), + }, + { + "name": "John Grisham", + // 4.2 + 3.2 + "byName": 7.4, + // 4.5 + 4.2 + "byRating": 8.7, + }, }, }, }, @@ -556,22 +564,24 @@ func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderDescAndRenderedChildre } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": float64(0), - "published": []map[string]any{}, - }, - { - "name": "John Grisham", - // 4.2 + 3.2 - "_sum": 7.4, - "published": []map[string]any{ - { - "name": "Painted House", - }, - { - "name": "Sooley", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": float64(0), + "published": []map[string]any{}, + }, + { + "name": "John Grisham", + // 4.2 + 3.2 + "_sum": 7.4, + "published": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "Sooley", + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_sum_limit_offset_test.go b/tests/integration/query/one_to_many/with_sum_limit_offset_test.go index ea89759d72..3fce23bfd5 100644 --- a/tests/integration/query/one_to_many/with_sum_limit_offset_test.go +++ b/tests/integration/query/one_to_many/with_sum_limit_offset_test.go @@ -65,14 +65,16 @@ func TestQueryOneToManyWithSumWithLimitAndOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": float64(0), - }, - { - "name": "John Grisham", - "_sum": 9.4, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": float64(0), + }, + { + "name": "John Grisham", + "_sum": 9.4, + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_sum_limit_test.go b/tests/integration/query/one_to_many/with_sum_limit_test.go index f7fe551567..4ab46b65bd 100644 --- a/tests/integration/query/one_to_many/with_sum_limit_test.go +++ b/tests/integration/query/one_to_many/with_sum_limit_test.go @@ -65,15 +65,17 @@ func TestQueryOneToManyWithSumWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": 4.8, - }, - { - "name": "John Grisham", - // .00...1 is float math thing - "_sum": 9.100000000000001, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": 4.8, + }, + { + "name": "John Grisham", + // .00...1 is float math thing + "_sum": 9.100000000000001, + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_typename_test.go b/tests/integration/query/one_to_many/with_typename_test.go index db318066f0..da627c8625 100644 --- a/tests/integration/query/one_to_many/with_typename_test.go +++ b/tests/integration/query/one_to_many/with_typename_test.go @@ -47,13 +47,15 @@ func TestQueryOneToManyWithTypeName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "__typename": "Book", - "author": map[string]any{ - "name": "John Grisham", - "__typename": "Author", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "__typename": "Book", + "author": map[string]any{ + "name": "John Grisham", + "__typename": "Author", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_average_filter_test.go b/tests/integration/query/one_to_many_multiple/with_average_filter_test.go index 9685790830..df4b6b5f2a 100644 --- a/tests/integration/query/one_to_many_multiple/with_average_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_average_filter_test.go @@ -122,14 +122,16 @@ func TestQueryOneToManyMultipleWithAverageOnMultipleJoinsWithAndWithoutFilter(t _avg(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_avg": float64(2.3333333333333335), - }, - { - "name": "John Grisham", - "_avg": float64(3), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_avg": float64(2.3333333333333335), + }, + { + "name": "John Grisham", + "_avg": float64(3), + }, }, }, }, @@ -245,14 +247,16 @@ func TestQueryOneToManyMultipleWithAverageOnMultipleJoinsWithFilters(t *testing. _avg(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating, filter: {rating: {_lt: 3}}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_avg": float64(2.3333333333333335), - }, - { - "name": "John Grisham", - "_avg": float64(0), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_avg": float64(2.3333333333333335), + }, + { + "name": "John Grisham", + "_avg": float64(0), + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_average_test.go b/tests/integration/query/one_to_many_multiple/with_average_test.go index a2af6b6a67..bf39888974 100644 --- a/tests/integration/query/one_to_many_multiple/with_average_test.go +++ b/tests/integration/query/one_to_many_multiple/with_average_test.go @@ -122,14 +122,16 @@ func TestQueryOneToManyMultipleWithAverageOnMultipleJoins(t *testing.T) { _avg(books: {field: score}, articles: {field: rating}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_avg": float64(2.3333333333333335), - }, - { - "name": "John Grisham", - "_avg": float64(2.25), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_avg": float64(2.3333333333333335), + }, + { + "name": "John Grisham", + "_avg": float64(2.25), + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_count_filter_test.go b/tests/integration/query/one_to_many_multiple/with_count_filter_test.go index 9cb9409d41..5aeca2386a 100644 --- a/tests/integration/query/one_to_many_multiple/with_count_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_count_filter_test.go @@ -122,14 +122,16 @@ func TestQueryOneToManyMultipleWithCountOnMultipleJoinsWithAndWithoutFilter(t *t _count(books: {filter: {score: {_gt: 3}}}, articles: {}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 3, - }, - { - "name": "John Grisham", - "_count": 1, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 3, + }, + { + "name": "John Grisham", + "_count": 1, + }, }, }, }, @@ -245,14 +247,16 @@ func TestQueryOneToManyMultipleWithCountOnMultipleJoinsWithFilters(t *testing.T) _count(books: {filter: {score: {_gt: 3}}}, articles: {filter: {rating: {_lt: 3}}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 3, - }, - { - "name": "John Grisham", - "_count": 0, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 3, + }, + { + "name": "John Grisham", + "_count": 0, + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_count_test.go b/tests/integration/query/one_to_many_multiple/with_count_test.go index f6155ffc16..eb932c80ad 100644 --- a/tests/integration/query/one_to_many_multiple/with_count_test.go +++ b/tests/integration/query/one_to_many_multiple/with_count_test.go @@ -115,16 +115,18 @@ func TestQueryOneToManyMultipleWithCount(t *testing.T) { numberOfArticles: _count(articles: {}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "numberOfBooks": 1, - "numberOfArticles": 2, - }, - { - "name": "John Grisham", - "numberOfBooks": 2, - "numberOfArticles": 1, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "numberOfBooks": 1, + "numberOfArticles": 2, + }, + { + "name": "John Grisham", + "numberOfBooks": 2, + "numberOfArticles": 1, + }, }, }, }, @@ -240,14 +242,16 @@ func TestQueryOneToManyMultipleWithCountOnMultipleJoins(t *testing.T) { _count(books: {}, articles: {}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_count": 3, - }, - { - "name": "John Grisham", - "_count": 4, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 3, + }, + { + "name": "John Grisham", + "_count": 4, + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go b/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go index a30f2f78a1..99bc3b2801 100644 --- a/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go @@ -121,9 +121,11 @@ func TestQueryOneToManyMultipleWithMultipleManyFilters(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go b/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go index f5f278a1f2..a35dce9aca 100644 --- a/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go @@ -122,14 +122,16 @@ func TestQueryOneToManyMultipleWithSumOnMultipleJoinsWithAndWithoutFilter(t *tes _sum(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": int64(7), - }, - { - "name": "John Grisham", - "_sum": int64(3), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": int64(7), + }, + { + "name": "John Grisham", + "_sum": int64(3), + }, }, }, }, @@ -245,14 +247,16 @@ func TestQueryOneToManyMultipleWithSumOnMultipleJoinsWithFilters(t *testing.T) { _sum(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating, filter: {rating: {_lt: 3}}}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": int64(7), - }, - { - "name": "John Grisham", - "_sum": int64(0), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": int64(7), + }, + { + "name": "John Grisham", + "_sum": int64(0), + }, }, }, }, diff --git a/tests/integration/query/one_to_many_multiple/with_sum_test.go b/tests/integration/query/one_to_many_multiple/with_sum_test.go index a1f9176722..b7f1e9d5d1 100644 --- a/tests/integration/query/one_to_many_multiple/with_sum_test.go +++ b/tests/integration/query/one_to_many_multiple/with_sum_test.go @@ -122,14 +122,16 @@ func TestQueryOneToManyMultipleWithSumOnMultipleJoins(t *testing.T) { _sum(books: {field: score}, articles: {field: rating}) } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "_sum": int64(7), - }, - { - "name": "John Grisham", - "_sum": int64(9), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": int64(7), + }, + { + "name": "John Grisham", + "_sum": int64(9), + }, }, }, }, diff --git a/tests/integration/query/one_to_many_to_many/joins_test.go b/tests/integration/query/one_to_many_to_many/joins_test.go index 1143eb1ba9..7fe84162e1 100644 --- a/tests/integration/query/one_to_many_to_many/joins_test.go +++ b/tests/integration/query/one_to_many_to_many/joins_test.go @@ -185,78 +185,80 @@ func TestOneToManyToManyJoinsAreLinkedProperly(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "_docID": testUtils.NewDocIndex(0, 2), - "book": []map[string]any{}, - "name": "Not a Writer", - }, - { - "name": "Cornelia Funke", - "_docID": testUtils.NewDocIndex(0, 1), - "book": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(1, 0), - "name": "The Rooster Bar", - "publisher": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(2, 0), - "name": "Only Publisher of The Rooster Bar", + Results: map[string]any{ + "Author": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(0, 2), + "book": []map[string]any{}, + "name": "Not a Writer", + }, + { + "name": "Cornelia Funke", + "_docID": testUtils.NewDocIndex(0, 1), + "book": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(1, 0), + "name": "The Rooster Bar", + "publisher": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(2, 0), + "name": "Only Publisher of The Rooster Bar", + }, }, }, }, }, - }, - { - "name": "John Grisham", - "_docID": testUtils.NewDocIndex(0, 0), - "book": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(1, 1), - "name": "Theif Lord", - "publisher": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(2, 1), - "name": "Only Publisher of Theif Lord", + { + "name": "John Grisham", + "_docID": testUtils.NewDocIndex(0, 0), + "book": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(1, 1), + "name": "Theif Lord", + "publisher": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(2, 1), + "name": "Only Publisher of Theif Lord", + }, }, }, - }, - { - "_docID": testUtils.NewDocIndex(1, 2), - "name": "The Associate", - "publisher": []map[string]any{}, - }, - { - "_docID": testUtils.NewDocIndex(1, 3), - "name": "Painted House", - "publisher": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(2, 2), - "name": "Only Publisher of Painted House", - }, + { + "_docID": testUtils.NewDocIndex(1, 2), + "name": "The Associate", + "publisher": []map[string]any{}, }, - }, - { - "_docID": testUtils.NewDocIndex(1, 4), - "name": "A Time for Mercy", - "publisher": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(2, 3), - "name": "Only Publisher of A Time for Mercy", + { + "_docID": testUtils.NewDocIndex(1, 3), + "name": "Painted House", + "publisher": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(2, 2), + "name": "Only Publisher of Painted House", + }, }, }, - }, - { - "_docID": testUtils.NewDocIndex(1, 5), - "name": "Sooley", - "publisher": []map[string]any{ - { - "_docID": testUtils.NewDocIndex(2, 5), - "name": "Second of Two Publishers of Sooley", + { + "_docID": testUtils.NewDocIndex(1, 4), + "name": "A Time for Mercy", + "publisher": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(2, 3), + "name": "Only Publisher of A Time for Mercy", + }, }, - { - "_docID": testUtils.NewDocIndex(2, 4), - "name": "First of Two Publishers of Sooley", + }, + { + "_docID": testUtils.NewDocIndex(1, 5), + "name": "Sooley", + "publisher": []map[string]any{ + { + "_docID": testUtils.NewDocIndex(2, 5), + "name": "Second of Two Publishers of Sooley", + }, + { + "_docID": testUtils.NewDocIndex(2, 4), + "name": "First of Two Publishers of Sooley", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_to_one/joins_test.go b/tests/integration/query/one_to_many_to_one/joins_test.go index 9cd6432112..1699096357 100644 --- a/tests/integration/query/one_to_many_to_one/joins_test.go +++ b/tests/integration/query/one_to_many_to_one/joins_test.go @@ -165,65 +165,67 @@ func TestOneToManyToOneJoinsAreLinkedProperly(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "_docID": "bae-489b4e01-4764-56f6-913f-b3c92dffcaa3", - "book": []map[string]any{}, - "name": "Not a Writer", - }, - { - "name": "John Grisham", - "_docID": "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", - "book": []map[string]any{ - { - "_docID": "bae-1d0dcbed-300a-567a-9b48-c23cd026d165", - "name": "A Time for Mercy", - "publisher": map[string]any{ - "_docID": "bae-2bad7de3-0f1a-56c0-b499-a552debef4b8", - "name": "Only Publisher of A Time for Mercy", + Results: map[string]any{ + "Author": []map[string]any{ + { + "_docID": "bae-489b4e01-4764-56f6-913f-b3c92dffcaa3", + "book": []map[string]any{}, + "name": "Not a Writer", + }, + { + "name": "John Grisham", + "_docID": "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", + "book": []map[string]any{ + { + "_docID": "bae-1d0dcbed-300a-567a-9b48-c23cd026d165", + "name": "A Time for Mercy", + "publisher": map[string]any{ + "_docID": "bae-2bad7de3-0f1a-56c0-b499-a552debef4b8", + "name": "Only Publisher of A Time for Mercy", + }, }, - }, - { - "_docID": "bae-374998e0-e84d-5f6b-9e87-5edaaa2d9c7d", - "name": "The Associate", - "publisher": nil, - }, - { - "_docID": "bae-7697f14d-7b32-5884-8677-344e183c14bf", - "name": "Theif Lord", - "publisher": map[string]any{ - "_docID": "bae-d43823c0-0bb6-58a9-a098-1826dffa4e4a", - "name": "Only Publisher of Theif Lord", + { + "_docID": "bae-374998e0-e84d-5f6b-9e87-5edaaa2d9c7d", + "name": "The Associate", + "publisher": nil, }, - }, - { - "_docID": "bae-aef1d940-5ac1-5924-a87f-63ac40758b22", - "name": "Painted House", - "publisher": map[string]any{ - "_docID": "bae-a104397b-7804-5cd0-93e5-c3986b4e5e71", - "name": "Only Publisher of Painted House", + { + "_docID": "bae-7697f14d-7b32-5884-8677-344e183c14bf", + "name": "Theif Lord", + "publisher": map[string]any{ + "_docID": "bae-d43823c0-0bb6-58a9-a098-1826dffa4e4a", + "name": "Only Publisher of Theif Lord", + }, }, - }, - { - "_docID": "bae-ee6b8339-8a9e-58a9-9a0d-dbd8d44fa149", - "name": "Sooley", - "publisher": map[string]any{ - "_docID": "bae-efeca601-cce1-5289-b392-85fa5b7bc0f7", - "name": "Only Publisher of Sooley", + { + "_docID": "bae-aef1d940-5ac1-5924-a87f-63ac40758b22", + "name": "Painted House", + "publisher": map[string]any{ + "_docID": "bae-a104397b-7804-5cd0-93e5-c3986b4e5e71", + "name": "Only Publisher of Painted House", + }, + }, + { + "_docID": "bae-ee6b8339-8a9e-58a9-9a0d-dbd8d44fa149", + "name": "Sooley", + "publisher": map[string]any{ + "_docID": "bae-efeca601-cce1-5289-b392-85fa5b7bc0f7", + "name": "Only Publisher of Sooley", + }, }, }, }, - }, - { - "name": "Cornelia Funke", - "_docID": "bae-fb2a1852-3951-5ce9-a3bf-6825202f201b", - "book": []map[string]any{ - { - "_docID": "bae-1867d7cb-01b3-572f-a993-1c3f22f46526", - "name": "The Rooster Bar", - "publisher": map[string]any{ - "_docID": "bae-09af7e39-8596-584f-8825-cb430c4156b3", - "name": "Only Publisher of The Rooster Bar", + { + "name": "Cornelia Funke", + "_docID": "bae-fb2a1852-3951-5ce9-a3bf-6825202f201b", + "book": []map[string]any{ + { + "_docID": "bae-1867d7cb-01b3-572f-a993-1c3f22f46526", + "name": "The Rooster Bar", + "publisher": map[string]any{ + "_docID": "bae-09af7e39-8596-584f-8825-cb430c4156b3", + "name": "Only Publisher of The Rooster Bar", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_to_one/simple_test.go b/tests/integration/query/one_to_many_to_one/simple_test.go index d1551300da..da6206c1e7 100644 --- a/tests/integration/query/one_to_many_to_one/simple_test.go +++ b/tests/integration/query/one_to_many_to_one/simple_test.go @@ -108,30 +108,32 @@ func TestQueryOneToOneRelations(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "The Rooster Bar", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "The Rooster Bar", + "author": map[string]any{ + "name": "Cornelia Funke", + }, + "publisher": map[string]any{ + "name": "Only Publisher of The Rooster Bar", + }, }, - "publisher": map[string]any{ - "name": "Only Publisher of The Rooster Bar", + { + "name": "The Associate", + "author": map[string]any{ + "name": "John Grisham", + }, + "publisher": nil, }, - }, - { - "name": "The Associate", - "author": map[string]any{ - "name": "John Grisham", - }, - "publisher": nil, - }, - { - "name": "Theif Lord", - "author": map[string]any{ - "name": "John Grisham", - }, - "publisher": map[string]any{ - "name": "Only Publisher of Theif Lord", + { + "name": "Theif Lord", + "author": map[string]any{ + "name": "John Grisham", + }, + "publisher": map[string]any{ + "name": "Only Publisher of Theif Lord", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_to_one/with_filter_test.go b/tests/integration/query/one_to_many_to_one/with_filter_test.go index bd56f7bc39..147f71f790 100644 --- a/tests/integration/query/one_to_many_to_one/with_filter_test.go +++ b/tests/integration/query/one_to_many_to_one/with_filter_test.go @@ -106,13 +106,15 @@ func TestQueryComplexWithDeepFilterOnRenderedChildren(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "book": []map[string]any{ - { - "publisher": map[string]any{ - "yearOpened": int64(2022), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "book": []map[string]any{ + { + "publisher": map[string]any{ + "yearOpened": int64(2022), + }, }, }, }, @@ -139,23 +141,25 @@ func TestOneToManyToOneWithSumOfDeepFilterSubTypeOfBothDescAndAsc(t *testing.T) s2: _sum(book: {field: rating, filter: {publisher: {yearOpened: {_ge: 2020}}}}) } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "s1": 0.0, - "s2": 0.0, - }, - { - "name": "John Grisham", - // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). - "s1": 4.5, - // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). - "s2": 4.8, - }, - { - "name": "Cornelia Funke", - "s1": 0.0, - "s2": 4.0, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "s2": 0.0, + }, + { + "name": "John Grisham", + // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). + "s1": 4.5, + // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). + "s2": 4.8, + }, + { + "name": "Cornelia Funke", + "s1": 0.0, + "s2": 4.0, + }, }, }, }, @@ -181,27 +185,29 @@ func TestOneToManyToOneWithSumOfDeepFilterSubTypeAndDeepOrderBySubtypeOppositeDi } } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "s1": 0.0, - "books2020": []map[string]any{}, - }, - { - "name": "John Grisham", - "s1": 4.5, - "books2020": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "books2020": []map[string]any{}, + }, + { + "name": "John Grisham", + "s1": 4.5, + "books2020": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - }, - { - "name": "Cornelia Funke", - "s1": 0.0, - "books2020": []map[string]any{ - { - "name": "The Rooster Bar", + { + "name": "Cornelia Funke", + "s1": 0.0, + "books2020": []map[string]any{ + { + "name": "The Rooster Bar", + }, }, }, }, @@ -231,50 +237,52 @@ func TestOneToManyToOneWithTwoLevelDeepFilter(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "book": []map[string]any{ - { - "name": "A Time for Mercy", - "publisher": map[string]any{ - "yearOpened": int64(2013), + Results: map[string]any{ + "Author": []map[string]any{ + { + "book": []map[string]any{ + { + "name": "A Time for Mercy", + "publisher": map[string]any{ + "yearOpened": int64(2013), + }, }, - }, - { - "name": "The Associate", - "publisher": nil, - }, - { - "name": "Theif Lord", - "publisher": map[string]any{ - "yearOpened": int64(2020), + { + "name": "The Associate", + "publisher": nil, }, - }, - { - "name": "Painted House", - "publisher": map[string]any{ - "yearOpened": int64(1995), + { + "name": "Theif Lord", + "publisher": map[string]any{ + "yearOpened": int64(2020), + }, }, - }, - { - "name": "Sooley", - "publisher": map[string]any{ - "yearOpened": int64(1999), + { + "name": "Painted House", + "publisher": map[string]any{ + "yearOpened": int64(1995), + }, + }, + { + "name": "Sooley", + "publisher": map[string]any{ + "yearOpened": int64(1999), + }, }, }, + "name": "John Grisham", }, - "name": "John Grisham", - }, - { - "book": []map[string]any{ - { - "name": "The Rooster Bar", - "publisher": map[string]any{ - "yearOpened": int64(2022), + { + "book": []map[string]any{ + { + "name": "The Rooster Bar", + "publisher": map[string]any{ + "yearOpened": int64(2022), + }, }, }, + "name": "Cornelia Funke", }, - "name": "Cornelia Funke", }, }, }, @@ -327,12 +335,14 @@ func TestOneToManyToOneWithCompoundOperatorInFilterAndRelation(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John Tolkien", - }, - { - "name": "Cornelia Funke", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Tolkien", + }, + { + "name": "Cornelia Funke", + }, }, }, }, @@ -349,9 +359,11 @@ func TestOneToManyToOneWithCompoundOperatorInFilterAndRelation(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John Grisham", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + }, }, }, }, @@ -388,12 +400,16 @@ func TestOneToManyToOneWithCompoundOperatorInSubFilterAndRelation(t *testing.T) } } }`, - Results: []map[string]any{{ - "name": "John Grisham", - "book": []map[string]any{{ - "name": "Sooley", - }}, - }}, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "book": []map[string]any{{ + "name": "Sooley", + }}, + }, + }, + }, }, }, } diff --git a/tests/integration/query/one_to_many_to_one/with_order_limit_test.go b/tests/integration/query/one_to_many_to_one/with_order_limit_test.go index 1ec7c0296e..196dd3bdf6 100644 --- a/tests/integration/query/one_to_many_to_one/with_order_limit_test.go +++ b/tests/integration/query/one_to_many_to_one/with_order_limit_test.go @@ -34,35 +34,37 @@ func TestOneToManyToOneDeepOrderBySubTypeOfBothDescAndAsc(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "NewestPublishersBook": []map[string]any{}, - "OldestPublishersBook": []map[string]any{}, - }, - { - "name": "John Grisham", - "NewestPublishersBook": []map[string]any{ - { - "name": "Theif Lord", - }, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "NewestPublishersBook": []map[string]any{}, + "OldestPublishersBook": []map[string]any{}, }, - "OldestPublishersBook": []map[string]any{ - { - "name": "The Associate", // oldest because has no Publisher. + { + "name": "John Grisham", + "NewestPublishersBook": []map[string]any{ + { + "name": "Theif Lord", + }, }, - }, - }, - { - "name": "Cornelia Funke", - "NewestPublishersBook": []map[string]any{ - { - "name": "The Rooster Bar", + "OldestPublishersBook": []map[string]any{ + { + "name": "The Associate", // oldest because has no Publisher. + }, }, }, - "OldestPublishersBook": []map[string]any{ - { - "name": "The Rooster Bar", + { + "name": "Cornelia Funke", + "NewestPublishersBook": []map[string]any{ + { + "name": "The Rooster Bar", + }, + }, + "OldestPublishersBook": []map[string]any{ + { + "name": "The Rooster Bar", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_to_one/with_order_test.go b/tests/integration/query/one_to_many_to_one/with_order_test.go index 91fccbe8d6..5036faf6d9 100644 --- a/tests/integration/query/one_to_many_to_one/with_order_test.go +++ b/tests/integration/query/one_to_many_to_one/with_order_test.go @@ -33,50 +33,52 @@ func TestMultipleOrderByWithDepthGreaterThanOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Sooley", - "rating": 3.2, - "publisher": map[string]any{ - "name": "Only Publisher of Sooley", - "yearOpened": int64(1999), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Sooley", + "rating": 3.2, + "publisher": map[string]any{ + "name": "Only Publisher of Sooley", + "yearOpened": int64(1999), + }, }, - }, - { - "name": "The Rooster Bar", - "rating": 4.0, - "publisher": map[string]any{ - "name": "Only Publisher of The Rooster Bar", - "yearOpened": int64(2022), + { + "name": "The Rooster Bar", + "rating": 4.0, + "publisher": map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "yearOpened": int64(2022), + }, }, - }, - { - "name": "The Associate", - "rating": 4.2, - "publisher": nil, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "publisher": map[string]any{ - "name": "Only Publisher of A Time for Mercy", - "yearOpened": int64(2013), + { + "name": "The Associate", + "rating": 4.2, + "publisher": nil, }, - }, - { - "name": "Theif Lord", - "rating": 4.8, - "publisher": map[string]any{ - "name": "Only Publisher of Theif Lord", - "yearOpened": int64(2020), + { + "name": "A Time for Mercy", + "rating": 4.5, + "publisher": map[string]any{ + "name": "Only Publisher of A Time for Mercy", + "yearOpened": int64(2013), + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "publisher": map[string]any{ - "name": "Only Publisher of Painted House", - "yearOpened": int64(1995), + { + "name": "Theif Lord", + "rating": 4.8, + "publisher": map[string]any{ + "name": "Only Publisher of Theif Lord", + "yearOpened": int64(2020), + }, + }, + { + "name": "Painted House", + "rating": 4.9, + "publisher": map[string]any{ + "name": "Only Publisher of Painted House", + "yearOpened": int64(1995), + }, }, }, }, @@ -104,51 +106,53 @@ func TestMultipleOrderByWithDepthGreaterThanOneOrderSwitched(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "The Rooster Bar", - "rating": 4.0, - "publisher": map[string]any{ - "name": "Only Publisher of The Rooster Bar", - "yearOpened": int64(2022), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "The Rooster Bar", + "rating": 4.0, + "publisher": map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "yearOpened": int64(2022), + }, }, - }, - { - "name": "Theif Lord", - "rating": 4.8, - "publisher": map[string]any{ - "name": "Only Publisher of Theif Lord", - "yearOpened": int64(2020), + { + "name": "Theif Lord", + "rating": 4.8, + "publisher": map[string]any{ + "name": "Only Publisher of Theif Lord", + "yearOpened": int64(2020), + }, }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "publisher": map[string]any{ - "name": "Only Publisher of A Time for Mercy", - "yearOpened": int64(2013), + { + "name": "A Time for Mercy", + "rating": 4.5, + "publisher": map[string]any{ + "name": "Only Publisher of A Time for Mercy", + "yearOpened": int64(2013), + }, }, - }, - { - "name": "Sooley", - "rating": 3.2, - "publisher": map[string]any{ - "name": "Only Publisher of Sooley", - "yearOpened": int64(1999), + { + "name": "Sooley", + "rating": 3.2, + "publisher": map[string]any{ + "name": "Only Publisher of Sooley", + "yearOpened": int64(1999), + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "publisher": map[string]any{ - "name": "Only Publisher of Painted House", - "yearOpened": int64(1995), + { + "name": "Painted House", + "rating": 4.9, + "publisher": map[string]any{ + "name": "Only Publisher of Painted House", + "yearOpened": int64(1995), + }, + }, + { + "name": "The Associate", + "rating": 4.2, + "publisher": nil, }, - }, - { - "name": "The Associate", - "rating": 4.2, - "publisher": nil, }, }, }, diff --git a/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go b/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go index 28379253b4..93e3040460 100644 --- a/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go +++ b/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go @@ -32,30 +32,32 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeDescDirec } } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "s1": 0.0, - "NewestPublishersBook": []map[string]any{}, - }, - { - "name": "John Grisham", - "s1": 4.8 + 4.5, // Because in descending order years for John are [2020, 2013]. - "NewestPublishersBook": []map[string]any{ - { - "name": "Theif Lord", - }, - { - "name": "A Time for Mercy", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "NewestPublishersBook": []map[string]any{}, + }, + { + "name": "John Grisham", + "s1": 4.8 + 4.5, // Because in descending order years for John are [2020, 2013]. + "NewestPublishersBook": []map[string]any{ + { + "name": "Theif Lord", + }, + { + "name": "A Time for Mercy", + }, }, }, - }, - { - "name": "Cornelia Funke", - "s1": 4.0, - "NewestPublishersBook": []map[string]any{ - { - "name": "The Rooster Bar", + { + "name": "Cornelia Funke", + "s1": 4.0, + "NewestPublishersBook": []map[string]any{ + { + "name": "The Rooster Bar", + }, }, }, }, @@ -82,32 +84,34 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeAscDirect } } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "s1": 0.0, - "NewestPublishersBook": []map[string]any{}, - }, - { - "name": "John Grisham", - // Because in ascending order years for John are: - // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). - "s1": float64(4.2) + float64(4.9), - "NewestPublishersBook": []map[string]any{ - { - "name": "The Associate", - }, - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "NewestPublishersBook": []map[string]any{}, + }, + { + "name": "John Grisham", + // Because in ascending order years for John are: + // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). + "s1": float64(4.2) + float64(4.9), + "NewestPublishersBook": []map[string]any{ + { + "name": "The Associate", + }, + { + "name": "Painted House", + }, }, }, - }, - { - "name": "Cornelia Funke", - "s1": 4.0, - "NewestPublishersBook": []map[string]any{ - { - "name": "The Rooster Bar", + { + "name": "Cornelia Funke", + "s1": 4.0, + "NewestPublishersBook": []map[string]any{ + { + "name": "The Rooster Bar", + }, }, }, }, @@ -133,23 +137,25 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeOfBothDescAndAsc(t *testing.T) s2: _sum(book: {field: rating, order: {publisher: {yearOpened: ASC}}, limit: 2}) } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "s1": 0.0, - "s2": 0.0, - }, - { - "name": "John Grisham", - // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). - "s1": 4.8 + 4.5, - // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). - "s2": float64(4.2) + float64(4.9), - }, - { - "name": "Cornelia Funke", - "s1": 4.0, - "s2": 4.0, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "s2": 0.0, + }, + { + "name": "John Grisham", + // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). + "s1": 4.8 + 4.5, + // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). + "s2": float64(4.2) + float64(4.9), + }, + { + "name": "Cornelia Funke", + "s1": 4.0, + "s2": 4.0, + }, }, }, }, @@ -175,31 +181,33 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeOppositeD } } }`, - Results: []map[string]any{ - { - "name": "Not a Writer", - "s1": 0.0, - "OldestPublishersBook": []map[string]any{}, - }, - { - "name": "John Grisham", - // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). - "s1": 4.8 + 4.5, - "OldestPublishersBook": []map[string]any{ - { - "name": "The Associate", - }, - { - "name": "Painted House", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "OldestPublishersBook": []map[string]any{}, + }, + { + "name": "John Grisham", + // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). + "s1": 4.8 + 4.5, + "OldestPublishersBook": []map[string]any{ + { + "name": "The Associate", + }, + { + "name": "Painted House", + }, }, }, - }, - { - "name": "Cornelia Funke", - "s1": 4.0, - "OldestPublishersBook": []map[string]any{ - { - "name": "The Rooster Bar", + { + "name": "Cornelia Funke", + "s1": 4.0, + "OldestPublishersBook": []map[string]any{ + { + "name": "The Rooster Bar", + }, }, }, }, diff --git a/tests/integration/query/one_to_many_to_one/with_sum_test.go b/tests/integration/query/one_to_many_to_one/with_sum_test.go index 192784144e..b140f94978 100644 --- a/tests/integration/query/one_to_many_to_one/with_sum_test.go +++ b/tests/integration/query/one_to_many_to_one/with_sum_test.go @@ -95,16 +95,18 @@ func TestQueryWithSumOnInlineAndSumOnOneToManyField(t *testing.T) { TotalRating: _sum(book: {field: rating}) } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "ThisMakesNoSenseToSumButHey": int64(-1 + 2 + -1 + 1 + 0), - "TotalRating": float64(4.8 + 4.2), - }, - { - "name": "Cornelia Funke", - "ThisMakesNoSenseToSumButHey": int64(0), - "TotalRating": float64(4), + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "ThisMakesNoSenseToSumButHey": int64(-1 + 2 + -1 + 1 + 0), + "TotalRating": float64(4.8 + 4.2), + }, + { + "name": "Cornelia Funke", + "ThisMakesNoSenseToSumButHey": int64(0), + "TotalRating": float64(4), + }, }, }, }, diff --git a/tests/integration/query/one_to_one/simple_test.go b/tests/integration/query/one_to_one/simple_test.go index f0eb5f1f4e..2ebad49df6 100644 --- a/tests/integration/query/one_to_one/simple_test.go +++ b/tests/integration/query/one_to_one/simple_test.go @@ -48,13 +48,15 @@ func TestQueryOneToOne(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -89,13 +91,15 @@ func TestQueryOneToOne(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "published": map[string]any{ - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "age": int64(65), + "published": map[string]any{ + "name": "Painted House", + "rating": 4.9, + }, }, }, }, @@ -168,17 +172,19 @@ func TestQueryOneToOneWithMultipleRecords(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Go Guide for Rust developers", - "author": map[string]any{ - "name": "Andrew Lone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Go Guide for Rust developers", + "author": map[string]any{ + "name": "Andrew Lone", + }, }, - }, - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -244,17 +250,19 @@ func TestQueryOneToOneWithMultipleRecordsSecondaryDirection(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "published": map[string]any{ - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "published": map[string]any{ + "name": "Theif Lord", + }, }, - }, - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, }, }, }, @@ -284,10 +292,12 @@ func TestQueryOneToOneWithNilChild(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": nil, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published": nil, + }, }, }, } @@ -314,10 +324,12 @@ func TestQueryOneToOneWithNilParent(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "author": nil, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author": nil, + }, }, }, } @@ -362,10 +374,12 @@ func TestQueryOneToOne_WithRelationIDFromPrimarySide(t *testing.T) { published_id } }`, - Results: []map[string]any{ - { - "name": "John Grisham", - "published_id": "bae-514f04b1-b218-5b8c-89ee-538f150a32b5", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "John Grisham", + "published_id": "bae-514f04b1-b218-5b8c-89ee-538f150a32b5", + }, }, }, }, @@ -412,10 +426,12 @@ func TestQueryOneToOne_WithRelationIDFromSecondarySide(t *testing.T) { author_id } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + }, }, }, }, diff --git a/tests/integration/query/one_to_one/with_clashing_id_field_test.go b/tests/integration/query/one_to_one/with_clashing_id_field_test.go index 368ea364a4..077416084f 100644 --- a/tests/integration/query/one_to_one/with_clashing_id_field_test.go +++ b/tests/integration/query/one_to_one/with_clashing_id_field_test.go @@ -59,12 +59,14 @@ func TestQueryOneToOneWithClashingIdFieldOnSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "author_id": "bae-1a0405fa-e17d-5b0f-8fe2-eb966938df1c", - "author": map[string]any{ - "name": "John Grisham", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "author_id": "bae-1a0405fa-e17d-5b0f-8fe2-eb966938df1c", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/query/one_to_one/with_count_filter_test.go b/tests/integration/query/one_to_one/with_count_filter_test.go index 9748bb7ca8..aa38267af4 100644 --- a/tests/integration/query/one_to_one/with_count_filter_test.go +++ b/tests/integration/query/one_to_one/with_count_filter_test.go @@ -94,10 +94,8 @@ func TestQueryOneToOneWithCountWithCompoundOrFilterThatIncludesRelation(t *testi {_not: {author: {age: {_gt: 30}}} } ]}}) }`, - Results: []map[string]any{ - { - "_count": int(2), - }, + Results: map[string]any{ + "_count": int(2), }, }, }, diff --git a/tests/integration/query/one_to_one/with_filter_order_test.go b/tests/integration/query/one_to_one/with_filter_order_test.go index 7ec7d88362..24682d4fb4 100644 --- a/tests/integration/query/one_to_one/with_filter_order_test.go +++ b/tests/integration/query/one_to_one/with_filter_order_test.go @@ -60,14 +60,16 @@ func TestOnetoOneSubTypeDscOrderByQueryWithFilterHavinghNoSubTypeSelections(t *t }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "Theif Lord", + "rating": 4.8, + }, }, }, } @@ -119,14 +121,16 @@ func TestOnetoOneSubTypeAscOrderByQueryWithFilterHavinghNoSubTypeSelections(t *t }`, }, }, - Results: []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - { - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + { + "name": "Painted House", + "rating": 4.9, + }, }, }, } diff --git a/tests/integration/query/one_to_one/with_filter_test.go b/tests/integration/query/one_to_one/with_filter_test.go index c9ae69f637..c3db221349 100644 --- a/tests/integration/query/one_to_one/with_filter_test.go +++ b/tests/integration/query/one_to_one/with_filter_test.go @@ -50,13 +50,15 @@ func TestQueryOneToOneWithNumericFilterOnParent(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -103,13 +105,15 @@ func TestQueryOneToOneWithStringFilterOnChild(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -156,13 +160,15 @@ func TestQueryOneToOneWithBooleanFilterOnChild(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -223,13 +229,15 @@ func TestQueryOneToOneWithFilterThroughChildBackToParent(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -270,10 +278,14 @@ func TestQueryOneToOneWithBooleanFilterOnChildWithNoSubTypeSelection(t *testing. rating } }`, - Results: []map[string]any{{ - "name": "Painted House", - "rating": 4.9, - }}, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + }, + }, }, }, } @@ -346,10 +358,14 @@ func TestQueryOneToOneWithCompoundAndFilterThatIncludesRelation(t *testing.T) { rating } }`, - Results: []map[string]any{{ - "name": "Painted House", - "rating": 4.9, - }}, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + }, + }, }, }, } @@ -443,12 +459,14 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Some Book", - }, - { - "name": "Some Other Book", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Some Book", + }, + { + "name": "Some Other Book", + }, }, }, }, @@ -461,12 +479,14 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Yet Another Book", - }, - { - "name": "Painted House", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Yet Another Book", + }, + { + "name": "Painted House", + }, }, }, }, @@ -541,14 +561,16 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul rating } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "Some Other Book", - "rating": 3.0, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "Some Other Book", + "rating": 3.0, + }, }, }, }, @@ -562,10 +584,12 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul rating } }`, - Results: []map[string]any{ - { - "name": "Some Book", - "rating": 4.0, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Some Book", + "rating": 4.0, + }, }, }, }, @@ -580,14 +604,16 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul rating } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "Some Other Book", - "rating": 3.0, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "Some Other Book", + "rating": 3.0, + }, }, }, }, diff --git a/tests/integration/query/one_to_one/with_group_related_id_alias_test.go b/tests/integration/query/one_to_one/with_group_related_id_alias_test.go index 1f98f6604b..9def4654f4 100644 --- a/tests/integration/query/one_to_one/with_group_related_id_alias_test.go +++ b/tests/integration/query/one_to_one/with_group_related_id_alias_test.go @@ -71,26 +71,28 @@ func TestQueryOneToOneWithGroupRelatedIDAlias(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "author_id": "bae-077b5e8d-5a86-5ae7-a321-ac7e423bb260", - "author": map[string]any{ - "name": "John Grisham", - }, - "_group": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-077b5e8d-5a86-5ae7-a321-ac7e423bb260", + "author": map[string]any{ + "name": "John Grisham", + }, + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, - }, - { - "author_id": "bae-b11e00fc-340f-558b-909d-2ab94601570b", - "author": map[string]any{ - "name": "Andrew Lone", - }, - "_group": []map[string]any{ - { - "name": "Go Guide for Rust developers", + { + "author_id": "bae-b11e00fc-340f-558b-909d-2ab94601570b", + "author": map[string]any{ + "name": "Andrew Lone", + }, + "_group": []map[string]any{ + { + "name": "Go Guide for Rust developers", + }, }, }, }, @@ -151,12 +153,14 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithoutInnerGroup(t *t author_id } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + }, + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + }, }, }, }, @@ -218,17 +222,19 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithoutInnerGroupWithJ } } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - "author": map[string]any{ - "name": "Andrew Lone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + "author": map[string]any{ + "name": "Andrew Lone", + }, }, - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", - "author": map[string]any{ - "name": "John Grisham", + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -291,20 +297,22 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithInnerGroup(t *test } } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - "_group": []map[string]any{ - { - "name": "Go Guide for Rust developers", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + "_group": []map[string]any{ + { + "name": "Go Guide for Rust developers", + }, }, }, - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", - "_group": []map[string]any{ - { - "name": "Painted House", + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -371,26 +379,28 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithInnerGroupWithJoin } } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - "author": map[string]any{ - "name": "Andrew Lone", - }, - "_group": []map[string]any{ - { - "name": "Go Guide for Rust developers", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + "author": map[string]any{ + "name": "Andrew Lone", + }, + "_group": []map[string]any{ + { + "name": "Go Guide for Rust developers", + }, }, }, - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", - "author": map[string]any{ - "name": "John Grisham", - }, - "_group": []map[string]any{ - { - "name": "Painted House", + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + "author": map[string]any{ + "name": "John Grisham", + }, + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/query/one_to_one/with_group_related_id_test.go b/tests/integration/query/one_to_one/with_group_related_id_test.go index d3b9867886..7607965203 100644 --- a/tests/integration/query/one_to_one/with_group_related_id_test.go +++ b/tests/integration/query/one_to_one/with_group_related_id_test.go @@ -68,20 +68,22 @@ func TestQueryOneToOneWithGroupRelatedID(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "author_id": "bae-077b5e8d-5a86-5ae7-a321-ac7e423bb260", - "_group": []map[string]any{ - { - "name": "Painted House", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-077b5e8d-5a86-5ae7-a321-ac7e423bb260", + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, - }, - { - "author_id": "bae-cfee1ed9-ede8-5b80-a6fa-78c727a076ac", - "_group": []map[string]any{ - { - "name": "Go Guide for Rust developers", + { + "author_id": "bae-cfee1ed9-ede8-5b80-a6fa-78c727a076ac", + "_group": []map[string]any{ + { + "name": "Go Guide for Rust developers", + }, }, }, }, @@ -142,12 +144,14 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithoutGroup(t *testing.T) author_id } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + }, + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + }, }, }, }, @@ -209,17 +213,19 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithoutGroupWithJoin(t *tes } } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - "author": map[string]any{ - "name": "Andrew Lone", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + "author": map[string]any{ + "name": "Andrew Lone", + }, }, - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", - "author": map[string]any{ - "name": "John Grisham", + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -282,20 +288,22 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithGroup(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "author_id": "bae-bb4d6e89-e8b4-5eec-bfeb-6f7aa4840950", - "_group": []map[string]any{ - { - "name": "Go Guide for Rust developers", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-bb4d6e89-e8b4-5eec-bfeb-6f7aa4840950", + "_group": []map[string]any{ + { + "name": "Go Guide for Rust developers", + }, }, }, - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", - "_group": []map[string]any{ - { - "name": "Painted House", + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, @@ -362,26 +370,28 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithGroupWithJoin(t *testin } } }`, - Results: []map[string]any{ - { - "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", - "author": map[string]any{ - "name": "Andrew Lone", - }, - "_group": []map[string]any{ - { - "name": "Go Guide for Rust developers", + Results: map[string]any{ + "Book": []map[string]any{ + { + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", + "author": map[string]any{ + "name": "Andrew Lone", + }, + "_group": []map[string]any{ + { + "name": "Go Guide for Rust developers", + }, }, }, - }, - { - "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", - "author": map[string]any{ - "name": "John Grisham", - }, - "_group": []map[string]any{ - { - "name": "Painted House", + { + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", + "author": map[string]any{ + "name": "John Grisham", + }, + "_group": []map[string]any{ + { + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/query/one_to_one/with_order_test.go b/tests/integration/query/one_to_one/with_order_test.go index bdf5d6d1e3..9a2ca8c4c9 100644 --- a/tests/integration/query/one_to_one/with_order_test.go +++ b/tests/integration/query/one_to_one/with_order_test.go @@ -61,21 +61,23 @@ func TestQueryOneToOneWithChildBooleanOrderDescending(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, - }, - { - "name": "Theif Lord", - "rating": 4.8, - "author": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), + { + "name": "Theif Lord", + "rating": 4.8, + "author": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, }, }, }, @@ -129,21 +131,23 @@ func TestQueryOneToOneWithChildBooleanOrderAscending(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - "author": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + "author": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - "age": int64(65), + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -193,14 +197,16 @@ func TestQueryOneToOneWithChildIntOrderDescendingWithNoSubTypeFieldsSelected(t * }`, }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "Theif Lord", - "rating": 4.8, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "Theif Lord", + "rating": 4.8, + }, }, }, } @@ -249,14 +255,16 @@ func TestQueryOneToOneWithChildIntOrderAscendingWithNoSubTypeFieldsSelected(t *t }`, }, }, - Results: []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - { - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + { + "name": "Painted House", + "rating": 4.9, + }, }, }, } diff --git a/tests/integration/query/one_to_one_multiple/simple_test.go b/tests/integration/query/one_to_one_multiple/simple_test.go index f7988a1940..66b823138a 100644 --- a/tests/integration/query/one_to_one_multiple/simple_test.go +++ b/tests/integration/query/one_to_one_multiple/simple_test.go @@ -91,23 +91,25 @@ func TestQueryOneToOneMultiple_FromPrimary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "publisher": map[string]any{ - "name": "Old Publisher", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "publisher": map[string]any{ + "name": "Old Publisher", + }, + "author": map[string]any{ + "name": "John Grisham", + }, }, - "author": map[string]any{ - "name": "John Grisham", - }, - }, - { - "name": "Theif Lord", - "publisher": map[string]any{ - "name": "New Publisher", - }, - "author": map[string]any{ - "name": "Cornelia Funke", + { + "name": "Theif Lord", + "publisher": map[string]any{ + "name": "New Publisher", + }, + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, }, @@ -193,23 +195,25 @@ func TestQueryOneToOneMultiple_FromMixedPrimaryAndSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Theif Lord", - "publisher": map[string]any{ - "name": "New Publisher", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Theif Lord", + "publisher": map[string]any{ + "name": "New Publisher", + }, + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, - "author": map[string]any{ - "name": "Cornelia Funke", - }, - }, - { - "name": "Painted House", - "publisher": map[string]any{ - "name": "Old Publisher", - }, - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Painted House", + "publisher": map[string]any{ + "name": "Old Publisher", + }, + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -295,23 +299,25 @@ func TestQueryOneToOneMultiple_FromSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "publisher": map[string]any{ - "name": "Old Publisher", - }, - "author": map[string]any{ - "name": "John Grisham", - }, - }, - { - "name": "Theif Lord", - "publisher": map[string]any{ - "name": "New Publisher", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "publisher": map[string]any{ + "name": "Old Publisher", + }, + "author": map[string]any{ + "name": "John Grisham", + }, }, - "author": map[string]any{ - "name": "Cornelia Funke", + { + "name": "Theif Lord", + "publisher": map[string]any{ + "name": "New Publisher", + }, + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, }, diff --git a/tests/integration/query/one_to_one_to_many/simple_test.go b/tests/integration/query/one_to_one_to_many/simple_test.go index cee2d465cf..3e65193cc7 100644 --- a/tests/integration/query/one_to_one_to_many/simple_test.go +++ b/tests/integration/query/one_to_one_to_many/simple_test.go @@ -71,13 +71,15 @@ func TestQueryOneToOneToMany(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Observation1", - "observable": map[string]any{ - "name": "Observable1", - "indicator": map[string]any{ - "name": "Indicator1", + Results: map[string]any{ + "Observation": []map[string]any{ + { + "name": "Observation1", + "observable": map[string]any{ + "name": "Observable1", + "indicator": map[string]any{ + "name": "Indicator1", + }, }, }, }, @@ -144,14 +146,16 @@ func TestQueryOneToOneToManyFromSecondaryOnOneToMany(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Indicator1", - "observable": map[string]any{ - "name": "Observable1", - "observations": []map[string]any{ - { - "name": "Observation1", + Results: map[string]any{ + "Indicator": []map[string]any{ + { + "name": "Indicator1", + "observable": map[string]any{ + "name": "Observable1", + "observations": []map[string]any{ + { + "name": "Observation1", + }, }, }, }, @@ -219,13 +223,15 @@ func TestQueryOneToOneToManyFromSecondaryOnOneToOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Observation1", - "observable": map[string]any{ - "name": "Observable1", - "indicator": map[string]any{ - "name": "Indicator1", + Results: map[string]any{ + "Observation": []map[string]any{ + { + "name": "Observation1", + "observable": map[string]any{ + "name": "Observable1", + "indicator": map[string]any{ + "name": "Indicator1", + }, }, }, }, @@ -292,14 +298,16 @@ func TestQueryOneToOneToManyFromSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Indicator1", - "observable": map[string]any{ - "name": "Observable1", - "observations": []map[string]any{ - { - "name": "Observation1", + Results: map[string]any{ + "Indicator": []map[string]any{ + { + "name": "Indicator1", + "observable": map[string]any{ + "name": "Observable1", + "observations": []map[string]any{ + { + "name": "Observation1", + }, }, }, }, diff --git a/tests/integration/query/one_to_one_to_one/simple_test.go b/tests/integration/query/one_to_one_to_one/simple_test.go index e788ddc732..bb054c4380 100644 --- a/tests/integration/query/one_to_one_to_one/simple_test.go +++ b/tests/integration/query/one_to_one_to_one/simple_test.go @@ -91,22 +91,24 @@ func TestQueryOneToOneToOne(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "New Publisher", - "printed": map[string]any{ - "name": "Theif Lord", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "name": "New Publisher", + "printed": map[string]any{ + "name": "Theif Lord", + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, - }, - { - "name": "Old Publisher", - "printed": map[string]any{ - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Old Publisher", + "printed": map[string]any{ + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -193,22 +195,24 @@ func TestQueryOneToOneToOneSecondaryThenPrimary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "New Publisher", - "printed": map[string]any{ - "name": "Theif Lord", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "name": "New Publisher", + "printed": map[string]any{ + "name": "Theif Lord", + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, - }, - { - "name": "Old Publisher", - "printed": map[string]any{ - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Old Publisher", + "printed": map[string]any{ + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -295,22 +299,24 @@ func TestQueryOneToOneToOnePrimaryThenSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "New Publisher", - "printed": map[string]any{ - "name": "Theif Lord", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "name": "New Publisher", + "printed": map[string]any{ + "name": "Theif Lord", + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, - }, - { - "name": "Old Publisher", - "printed": map[string]any{ - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Old Publisher", + "printed": map[string]any{ + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, @@ -397,22 +403,24 @@ func TestQueryOneToOneToOneSecondary(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "New Publisher", - "printed": map[string]any{ - "name": "Theif Lord", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "name": "New Publisher", + "printed": map[string]any{ + "name": "Theif Lord", + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, - }, - { - "name": "Old Publisher", - "printed": map[string]any{ - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Old Publisher", + "printed": map[string]any{ + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/query/one_to_one_to_one/with_order_test.go b/tests/integration/query/one_to_one_to_one/with_order_test.go index 899f890f74..4c241cc281 100644 --- a/tests/integration/query/one_to_one_to_one/with_order_test.go +++ b/tests/integration/query/one_to_one_to_one/with_order_test.go @@ -91,22 +91,24 @@ func TestQueryOneToOneToOneWithNestedOrder(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "New Publisher", - "printed": map[string]any{ - "name": "Theif Lord", - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Publisher": []map[string]any{ + { + "name": "New Publisher", + "printed": map[string]any{ + "name": "Theif Lord", + "author": map[string]any{ + "name": "Cornelia Funke", + }, }, }, - }, - { - "name": "Old Publisher", - "printed": map[string]any{ - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + { + "name": "Old Publisher", + "printed": map[string]any{ + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, }, }, }, diff --git a/tests/integration/query/one_to_two_many/simple_test.go b/tests/integration/query/one_to_two_many/simple_test.go index 58a677d6fa..47e946b6e4 100644 --- a/tests/integration/query/one_to_two_many/simple_test.go +++ b/tests/integration/query/one_to_two_many/simple_test.go @@ -95,38 +95,40 @@ func TestQueryOneToTwoManyWithNilUnnamedRelationship_FromOneSide(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), - }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, }, - }, - { - "name": "Theif Lord", - "rating": 4.8, - "author": map[string]any{ - "name": "Cornelia Funke", + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, }, - "reviewedBy": map[string]any{ - "name": "John Grisham", - "age": int64(65), + { + "name": "Theif Lord", + "rating": 4.8, + "author": map[string]any{ + "name": "Cornelia Funke", + }, + "reviewedBy": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, }, }, }, @@ -216,41 +218,43 @@ func TestQueryOneToTwoManyWithNilUnnamedRelationship_FromManySide(t *testing.T) } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "age": int64(62), - "reviewed": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - }, - }, - "written": []map[string]any{ - { - "name": "Theif Lord", + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "reviewed": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, - }, - }, - { - "name": "John Grisham", - "age": int64(65), - "reviewed": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + "written": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - "written": []map[string]any{ - { - "name": "Painted House", + { + "name": "John Grisham", + "age": int64(65), + "reviewed": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, - { - "name": "A Time for Mercy", + "written": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "A Time for Mercy", + }, }, }, }, @@ -369,50 +373,52 @@ func TestQueryOneToTwoManyWithNamedAndUnnamedRelationships(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), - }, - "price": map[string]any{ - "currency": "GBP", - "value": 12.99, - }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), - }, - "price": map[string]any{ - "currency": "SEK", - "value": float64(129), - }, - }, - { - "name": "Theif Lord", - "rating": 4.8, - "author": map[string]any{ - "name": "Cornelia Funke", + Results: map[string]any{ + "Book": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, + "price": map[string]any{ + "currency": "GBP", + "value": 12.99, + }, }, - "reviewedBy": map[string]any{ - "name": "John Grisham", - "age": int64(65), + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, + "price": map[string]any{ + "currency": "SEK", + "value": float64(129), + }, }, - "price": map[string]any{ - "currency": "GBP", - "value": 12.99, + { + "name": "Theif Lord", + "rating": 4.8, + "author": map[string]any{ + "name": "Cornelia Funke", + }, + "reviewedBy": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, + "price": map[string]any{ + "currency": "GBP", + "value": 12.99, + }, }, }, }, @@ -529,49 +535,51 @@ func TestQueryOneToTwoManyWithNamedAndUnnamedRelationships_FromManySide(t *testi } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "age": int64(62), - "reviewed": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - }, - }, - "written": []map[string]any{ - { - "name": "Theif Lord", - "price": map[string]any{ - "value": 12.99, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "reviewed": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, }, }, - }, - }, - { - "name": "John Grisham", - "age": int64(65), - "reviewed": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + "written": []map[string]any{ + { + "name": "Theif Lord", + "price": map[string]any{ + "value": 12.99, + }, + }, }, }, - "written": []map[string]any{ - { - "name": "Painted House", - "price": map[string]any{ - "value": 12.99, + { + "name": "John Grisham", + "age": int64(65), + "reviewed": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, }, }, - { - "name": "A Time for Mercy", - "price": map[string]any{ - "value": float64(129), + "written": []map[string]any{ + { + "name": "Painted House", + "price": map[string]any{ + "value": 12.99, + }, + }, + { + "name": "A Time for Mercy", + "price": map[string]any{ + "value": float64(129), + }, }, }, }, diff --git a/tests/integration/query/one_to_two_many/with_order_test.go b/tests/integration/query/one_to_two_many/with_order_test.go index d84aa4e869..fd58bdb3d6 100644 --- a/tests/integration/query/one_to_two_many/with_order_test.go +++ b/tests/integration/query/one_to_two_many/with_order_test.go @@ -95,39 +95,41 @@ func TestQueryOneToTwoManyWithOrder(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Cornelia Funke", - "reviewed": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + Results: map[string]any{ + "Author": []map[string]any{ + { + "name": "Cornelia Funke", + "reviewed": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, - }, - "written": []map[string]any{ - { - "name": "Theif Lord", - }, - }, - }, - { - "name": "John Grisham", - "reviewed": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + "written": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - "written": []map[string]any{ - { - "name": "A Time for Mercy", + { + "name": "John Grisham", + "reviewed": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, - { - "name": "Painted House", + "written": []map[string]any{ + { + "name": "A Time for Mercy", + }, + { + "name": "Painted House", + }, }, }, }, diff --git a/tests/integration/query/simple/simple_test.go b/tests/integration/query/simple/simple_test.go index 5872998e81..fce69f1412 100644 --- a/tests/integration/query/simple/simple_test.go +++ b/tests/integration/query/simple/simple_test.go @@ -34,11 +34,13 @@ func TestQuerySimple(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", + "Name": "John", + "Age": int64(21), + }, }, }, } @@ -63,10 +65,12 @@ func TestQuerySimpleWithAlias(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "username": "John", - "age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "username": "John", + "age": int64(21), + }, }, }, } @@ -95,14 +99,16 @@ func TestQuerySimpleWithMultipleRows(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", - "Age": int64(27), - }, - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + "Age": int64(27), + }, + { + "Name": "John", + "Age": int64(21), + }, }, }, } @@ -144,13 +150,15 @@ func TestQuerySimpleWithSomeDefaultValues(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Email": nil, - "Age": nil, - "HeightM": nil, - "Verified": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Email": nil, + "Age": nil, + "HeightM": nil, + "Verified": nil, + }, }, }, } @@ -175,13 +183,15 @@ func TestQuerySimpleWithDefaultValue(t *testing.T) { `{ }`, }, }, - Results: []map[string]any{ - { - "Name": nil, - "Email": nil, - "Age": nil, - "HeightM": nil, - "Verified": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": nil, + "Email": nil, + "Age": nil, + "HeightM": nil, + "Verified": nil, + }, }, }, } diff --git a/tests/integration/query/simple/with_average_filter_test.go b/tests/integration/query/simple/with_average_filter_test.go index 8711c56e6b..48bf59ab89 100644 --- a/tests/integration/query/simple/with_average_filter_test.go +++ b/tests/integration/query/simple/with_average_filter_test.go @@ -38,10 +38,8 @@ func TestQuerySimpleWithAverageWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_avg": float64(31), - }, + Results: map[string]any{ + "_avg": float64(31), }, } @@ -73,10 +71,8 @@ func TestQuerySimpleWithAverageWithDateTimeFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_avg": float64(31), - }, + Results: map[string]any{ + "_avg": float64(31), }, } diff --git a/tests/integration/query/simple/with_average_test.go b/tests/integration/query/simple/with_average_test.go index bd7ddbe6d5..1237c21cb6 100644 --- a/tests/integration/query/simple/with_average_test.go +++ b/tests/integration/query/simple/with_average_test.go @@ -46,10 +46,8 @@ func TestQuerySimpleWithAverageOnEmptyCollection(t *testing.T) { Request: `query { _avg(Users: {field: Age}) }`, - Results: []map[string]any{ - { - "_avg": float64(0), - }, + Results: map[string]any{ + "_avg": float64(0), }, } @@ -74,10 +72,8 @@ func TestQuerySimpleWithAverage(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_avg": float64(29), - }, + Results: map[string]any{ + "_avg": float64(29), }, } diff --git a/tests/integration/query/simple/with_cid_doc_id_test.go b/tests/integration/query/simple/with_cid_doc_id_test.go index 34dbbd5512..4cb1614ddc 100644 --- a/tests/integration/query/simple/with_cid_doc_id_test.go +++ b/tests/integration/query/simple/with_cid_doc_id_test.go @@ -99,9 +99,11 @@ func TestQuerySimpleWithCidAndDocID(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -141,9 +143,11 @@ func TestQuerySimpleWithUpdateAndFirstCidAndDocID(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -183,9 +187,11 @@ func TestQuerySimpleWithUpdateAndLastCidAndDocID(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Johnn", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Johnn", + }, }, }, }, @@ -230,9 +236,11 @@ func TestQuerySimpleWithUpdateAndMiddleCidAndDocID(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Johnn", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Johnn", + }, }, }, }, @@ -275,12 +283,14 @@ func TestQuerySimpleWithUpdateAndFirstCidAndDocIDAndSchemaVersion(t *testing.T) } } }`, - Results: []map[string]any{ - { - "name": "John", - "_version": []map[string]any{ - { - "schemaVersionId": "bafkreia3o3cetvcnnxyu5spucimoos77ifungfmacxdkva4zah2is3aooe", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_version": []map[string]any{ + { + "schemaVersionId": "bafkreia3o3cetvcnnxyu5spucimoos77ifungfmacxdkva4zah2is3aooe", + }, }, }, }, @@ -331,10 +341,12 @@ func TestCidAndDocIDQuery_ContainsPNCounterWithIntKind_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(10), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(10), + }, }, }, }, @@ -383,10 +395,12 @@ func TestCidAndDocIDQuery_ContainsPNCounterWithFloatKind_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": 10.2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": 10.2, + }, }, }, }, @@ -430,10 +444,12 @@ func TestCidAndDocIDQuery_ContainsPCounterWithIntKind_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": int64(10), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": int64(10), + }, }, }, }, @@ -477,10 +493,12 @@ func TestCidAndDocIDQuery_ContainsPCounterWithFloatKind_NoError(t *testing.T) { points } }`, - Results: []map[string]any{ - { - "name": "John", - "points": 10.2, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "points": 10.2, + }, }, }, }, diff --git a/tests/integration/query/simple/with_count_filter_test.go b/tests/integration/query/simple/with_count_filter_test.go index 4724815a9c..8bf9182bfe 100644 --- a/tests/integration/query/simple/with_count_filter_test.go +++ b/tests/integration/query/simple/with_count_filter_test.go @@ -38,10 +38,8 @@ func TestQuerySimpleWithCountWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_count": 2, - }, + Results: map[string]any{ + "_count": 2, }, } @@ -73,10 +71,8 @@ func TestQuerySimpleWithCountWithDateTimeFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_count": 2, - }, + Results: map[string]any{ + "_count": 2, }, } diff --git a/tests/integration/query/simple/with_count_test.go b/tests/integration/query/simple/with_count_test.go index 47cb153c85..338d6847b6 100644 --- a/tests/integration/query/simple/with_count_test.go +++ b/tests/integration/query/simple/with_count_test.go @@ -34,10 +34,8 @@ func TestQuerySimpleWithCountOnEmptyCollection(t *testing.T) { Request: `query { _count(Users: {}) }`, - Results: []map[string]any{ - { - "_count": 0, - }, + Results: map[string]any{ + "_count": 0, }, } @@ -62,10 +60,8 @@ func TestQuerySimpleWithCount(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_count": 2, - }, + Results: map[string]any{ + "_count": 2, }, } diff --git a/tests/integration/query/simple/with_deleted_field_test.go b/tests/integration/query/simple/with_deleted_field_test.go index cc302e29b7..383c2b49b5 100644 --- a/tests/integration/query/simple/with_deleted_field_test.go +++ b/tests/integration/query/simple/with_deleted_field_test.go @@ -49,14 +49,16 @@ func TestQuerySimple_WithDeletedField(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "_deleted": true, - "name": "John", - }, - { - "_deleted": true, - "name": "Andy", + Results: map[string]any{ + "User": []map[string]any{ + { + "_deleted": true, + "name": "John", + }, + { + "_deleted": true, + "name": "Andy", + }, }, }, }, diff --git a/tests/integration/query/simple/with_doc_id_filter_test.go b/tests/integration/query/simple/with_doc_id_filter_test.go index 7c1e886787..91bf2ef9cb 100644 --- a/tests/integration/query/simple/with_doc_id_filter_test.go +++ b/tests/integration/query/simple/with_doc_id_filter_test.go @@ -37,10 +37,12 @@ func TestQuerySimpleWithDocIDFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, } diff --git a/tests/integration/query/simple/with_doc_id_test.go b/tests/integration/query/simple/with_doc_id_test.go index 7d5e7c0206..5f0b6fb316 100644 --- a/tests/integration/query/simple/with_doc_id_test.go +++ b/tests/integration/query/simple/with_doc_id_test.go @@ -34,10 +34,12 @@ func TestQuerySimpleWithDocIDFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -57,7 +59,9 @@ func TestQuerySimpleWithDocIDFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, { Description: "Simple query with basic filter (by docID arg), partial results", @@ -79,10 +83,12 @@ func TestQuerySimpleWithDocIDFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, diff --git a/tests/integration/query/simple/with_doc_ids_test.go b/tests/integration/query/simple/with_doc_ids_test.go index 1dc61bb610..285a84f87e 100644 --- a/tests/integration/query/simple/with_doc_ids_test.go +++ b/tests/integration/query/simple/with_doc_ids_test.go @@ -34,10 +34,12 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -57,7 +59,9 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, { Description: "Simple query with basic filter (duplicate ID by docIDs arg), partial results", @@ -79,10 +83,12 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -110,14 +116,16 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Jim", - "Age": int64(27), - }, - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Jim", + "Age": int64(27), + }, + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -145,7 +153,9 @@ func TestQuerySimpleReturnsNothinGivenEmptyDocIDsFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) diff --git a/tests/integration/query/simple/with_filter/with_and_test.go b/tests/integration/query/simple/with_filter/with_and_test.go index bbcbeb38b9..4bac7cf5af 100644 --- a/tests/integration/query/simple/with_filter/with_and_test.go +++ b/tests/integration/query/simple/with_filter/with_and_test.go @@ -45,14 +45,16 @@ func TestQuerySimpleWithIntGreaterThanAndIntLessThanFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_eq_blob_test.go b/tests/integration/query/simple/with_filter/with_eq_blob_test.go index 76a804f98a..25d7fb9840 100644 --- a/tests/integration/query/simple/with_filter/with_eq_blob_test.go +++ b/tests/integration/query/simple/with_filter/with_eq_blob_test.go @@ -45,7 +45,11 @@ func TestQuerySimple_WithEqOpOnBlobField_ShouldFilter(t *testing.T) { name } }`, - Results: []map[string]any{{"name": "John"}}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "John"}, + }, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_eq_datetime_test.go b/tests/integration/query/simple/with_filter/with_eq_datetime_test.go index bf4518749a..0f72bd05ab 100644 --- a/tests/integration/query/simple/with_filter/with_eq_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_eq_datetime_test.go @@ -40,11 +40,13 @@ func TestQuerySimpleWithDateTimeEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - "CreatedAt": testUtils.MustParseTime("2017-07-23T03:46:56-05:00"), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + "CreatedAt": testUtils.MustParseTime("2017-07-23T03:46:56-05:00"), + }, }, }, } @@ -80,11 +82,13 @@ func TestQuerySimpleWithDateTimeEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Fred", - "Age": int64(44), - "CreatedAt": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Fred", + "Age": int64(44), + "CreatedAt": nil, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_eq_float_test.go b/tests/integration/query/simple/with_filter/with_eq_float_test.go index 2e5f677e7b..340236f580 100644 --- a/tests/integration/query/simple/with_filter/with_eq_float_test.go +++ b/tests/integration/query/simple/with_filter/with_eq_float_test.go @@ -37,10 +37,12 @@ func TestQuerySimpleWithFloatEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "HeightM": float64(2.1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "HeightM": float64(2.1), + }, }, }, } @@ -72,10 +74,12 @@ func TestQuerySimpleWithFloatEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Fred", - "HeightM": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Fred", + "HeightM": nil, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_eq_int_test.go b/tests/integration/query/simple/with_filter/with_eq_int_test.go index 067c2d2198..576f2fa38e 100644 --- a/tests/integration/query/simple/with_filter/with_eq_int_test.go +++ b/tests/integration/query/simple/with_filter/with_eq_int_test.go @@ -37,10 +37,12 @@ func TestQuerySimpleWithIntEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, } @@ -72,10 +74,12 @@ func TestQuerySimpleWithIntEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Fred", - "Age": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Fred", + "Age": nil, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_eq_json_test.go b/tests/integration/query/simple/with_filter/with_eq_json_test.go index d0d9e93369..da0c03ed4b 100644 --- a/tests/integration/query/simple/with_filter/with_eq_json_test.go +++ b/tests/integration/query/simple/with_filter/with_eq_json_test.go @@ -46,7 +46,11 @@ func TestQuerySimple_WithEqOpOnJSONField_ShouldFilter(t *testing.T) { name } }`, - Results: []map[string]any{{"name": "Andy"}}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "Andy"}, + }, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_eq_string_test.go b/tests/integration/query/simple/with_filter/with_eq_string_test.go index 18b03bee58..bc9d249877 100644 --- a/tests/integration/query/simple/with_filter/with_eq_string_test.go +++ b/tests/integration/query/simple/with_filter/with_eq_string_test.go @@ -37,10 +37,12 @@ func TestQuerySimpleWithStringFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, } @@ -72,10 +74,12 @@ func TestQuerySimpleWithStringEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": nil, - "Age": int64(60), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": nil, + "Age": int64(60), + }, }, }, } @@ -104,9 +108,11 @@ func TestQuerySimpleWithStringFilterBlockAndSelect(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, @@ -129,9 +135,11 @@ func TestQuerySimpleWithStringFilterBlockAndSelect(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, }, }, }, @@ -151,7 +159,9 @@ func TestQuerySimpleWithStringFilterBlockAndSelect(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ge_datetime_test.go b/tests/integration/query/simple/with_filter/with_ge_datetime_test.go index 69eddcd9c4..a21a120c44 100644 --- a/tests/integration/query/simple/with_filter/with_ge_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_ge_datetime_test.go @@ -38,9 +38,11 @@ func TestQuerySimpleWithDateTimeGEFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -70,9 +72,11 @@ func TestQuerySimpleWithDateTimeGEFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -102,7 +106,9 @@ func TestQuerySimpleWithDateTimeGEFilterBlockWithLesserValue(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -127,12 +133,14 @@ func TestQuerySimpleWithDateTimeGEFilterBlockWithNilValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ge_float_test.go b/tests/integration/query/simple/with_filter/with_ge_float_test.go index 3983f08718..be0a6d9c12 100644 --- a/tests/integration/query/simple/with_filter/with_ge_float_test.go +++ b/tests/integration/query/simple/with_filter/with_ge_float_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithHeightMGEFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimpleWithHeightMGEFilterBlockWithLesserValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -96,9 +100,11 @@ func TestQuerySimpleWithHeightMGEFilterBlockWithLesserIntValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -125,12 +131,14 @@ func TestQuerySimpleWithHeightMGEFilterBlockWithNilValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ge_int_test.go b/tests/integration/query/simple/with_filter/with_ge_int_test.go index e780bef687..5a07a18b01 100644 --- a/tests/integration/query/simple/with_filter/with_ge_int_test.go +++ b/tests/integration/query/simple/with_filter/with_ge_int_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithIntGEFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimpleWithIntGEFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -95,12 +99,14 @@ func TestQuerySimpleWithIntGEFilterBlockWithNilValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_gt_datetime_test.go b/tests/integration/query/simple/with_filter/with_gt_datetime_test.go index 468dcf07e5..e12a74a36f 100644 --- a/tests/integration/query/simple/with_filter/with_gt_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_gt_datetime_test.go @@ -38,9 +38,11 @@ func TestQuerySimpleWithDateTimeGTFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -70,9 +72,11 @@ func TestQuerySimpleWithDateTimeGTFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -102,7 +106,9 @@ func TestQuerySimpleWithDateTimeGTFilterBlockWithLesserValue(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -127,9 +133,11 @@ func TestQuerySimpleWithDateTimeGTFilterBlockWithNilValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_gt_float_test.go b/tests/integration/query/simple/with_filter/with_gt_float_test.go index fea3cc968a..da72d4df51 100644 --- a/tests/integration/query/simple/with_filter/with_gt_float_test.go +++ b/tests/integration/query/simple/with_filter/with_gt_float_test.go @@ -37,9 +37,11 @@ func TestQuerySimpleWithFloatGreaterThanFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, }, @@ -62,7 +64,9 @@ func TestQuerySimpleWithFloatGreaterThanFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, { Description: "Simple query with basic float greater than filter, multiple results", @@ -83,12 +87,14 @@ func TestQuerySimpleWithFloatGreaterThanFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Bob", + }, }, }, }, @@ -119,9 +125,11 @@ func TestQuerySimpleWithFloatGreaterThanFilterBlockWithIntFilterValue(t *testing }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -148,9 +156,11 @@ func TestQuerySimpleWithFloatGreaterThanFilterBlockWithNullFilterValue(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_gt_int_test.go b/tests/integration/query/simple/with_filter/with_gt_int_test.go index d832114cac..3cbdf82250 100644 --- a/tests/integration/query/simple/with_filter/with_gt_int_test.go +++ b/tests/integration/query/simple/with_filter/with_gt_int_test.go @@ -38,10 +38,12 @@ func TestQuerySimpleWithIntGreaterThanFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -65,7 +67,9 @@ func TestQuerySimpleWithIntGreaterThanFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, { Description: "Simple query with basic filter(age), multiple results", @@ -87,14 +91,16 @@ func TestQuerySimpleWithIntGreaterThanFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, }, }, }, @@ -124,9 +130,11 @@ func TestQuerySimpleWithIntGreaterThanFilterBlockWithNullFilterValue(t *testing. }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_in_blob_test.go b/tests/integration/query/simple/with_filter/with_in_blob_test.go index a168a297ac..64a8b17888 100644 --- a/tests/integration/query/simple/with_filter/with_in_blob_test.go +++ b/tests/integration/query/simple/with_filter/with_in_blob_test.go @@ -45,7 +45,11 @@ func TestQuerySimple_WithInOpOnBlobField_ShouldFilter(t *testing.T) { name } }`, - Results: []map[string]any{{"name": "John"}}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "John"}, + }, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_in_json_test.go b/tests/integration/query/simple/with_filter/with_in_json_test.go index cb4fcdc7da..b9bab035f4 100644 --- a/tests/integration/query/simple/with_filter/with_in_json_test.go +++ b/tests/integration/query/simple/with_filter/with_in_json_test.go @@ -46,7 +46,11 @@ func TestQuerySimple_WithInOpOnJSONField_ShouldFilter(t *testing.T) { name } }`, - Results: []map[string]any{{"name": "Andy"}}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "Andy"}, + }, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_in_test.go b/tests/integration/query/simple/with_filter/with_in_test.go index 75867469d9..887a4ccbdb 100644 --- a/tests/integration/query/simple/with_filter/with_in_test.go +++ b/tests/integration/query/simple/with_filter/with_in_test.go @@ -45,14 +45,16 @@ func TestQuerySimpleWithIntInFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } @@ -88,12 +90,14 @@ func TestQuerySimpleWithIntInFilterOnFloat(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + }, + { + "Name": "John", + }, }, }, } @@ -133,18 +137,20 @@ func TestQuerySimpleWithIntInFilterWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Fred", - "Age": nil, - }, - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Fred", + "Age": nil, + }, + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_le_datetime_test.go b/tests/integration/query/simple/with_filter/with_le_datetime_test.go index 051a97de43..3e1dc9ff96 100644 --- a/tests/integration/query/simple/with_filter/with_le_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_le_datetime_test.go @@ -38,9 +38,11 @@ func TestQuerySimpleWithDateTimeLEFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -70,9 +72,11 @@ func TestQuerySimpleWithDateTimeLEFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -101,9 +105,11 @@ func TestQuerySimpleWithDateTimeLEFilterBlockWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_le_float_test.go b/tests/integration/query/simple/with_filter/with_le_float_test.go index 45be20cb44..f5d2e7e3fc 100644 --- a/tests/integration/query/simple/with_filter/with_le_float_test.go +++ b/tests/integration/query/simple/with_filter/with_le_float_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithFloatLEFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimpleWithFloatLEFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -96,9 +100,11 @@ func TestQuerySimpleWithFloatLEFilterBlockWithGreaterIntValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -125,9 +131,11 @@ func TestQuerySimpleWithFloatLEFilterBlockWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_le_int_test.go b/tests/integration/query/simple/with_filter/with_le_int_test.go index 2d9f543b12..1dd363c25e 100644 --- a/tests/integration/query/simple/with_filter/with_le_int_test.go +++ b/tests/integration/query/simple/with_filter/with_le_int_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithIntLEFilterBlockWithEqualValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimpleWithIntLEFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -95,9 +99,11 @@ func TestQuerySimpleWithIntLEFilterBlockWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_like_blob_test.go b/tests/integration/query/simple/with_filter/with_like_blob_test.go index bc51930f06..84e1ed3825 100644 --- a/tests/integration/query/simple/with_filter/with_like_blob_test.go +++ b/tests/integration/query/simple/with_filter/with_like_blob_test.go @@ -45,7 +45,11 @@ func TestQuerySimple_WithLikeOpOnBlobField_ShouldFilter(t *testing.T) { name } }`, - Results: []map[string]any{{"name": "John"}}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "John"}, + }, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_like_json_test.go b/tests/integration/query/simple/with_filter/with_like_json_test.go index ed092dd502..f77041ada0 100644 --- a/tests/integration/query/simple/with_filter/with_like_json_test.go +++ b/tests/integration/query/simple/with_filter/with_like_json_test.go @@ -45,7 +45,11 @@ func TestQuerySimple_WithLikeOpOnJSONField_ShouldFilter(t *testing.T) { name } }`, - Results: []map[string]any{{"name": "Andy"}}, + Results: map[string]any{ + "Users": []map[string]any{ + {"name": "Andy"}, + }, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_like_string_test.go b/tests/integration/query/simple/with_filter/with_like_string_test.go index ff6ddf1fa2..9aa5ede34b 100644 --- a/tests/integration/query/simple/with_filter/with_like_string_test.go +++ b/tests/integration/query/simple/with_filter/with_like_string_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockContainsString(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimple_WithCaseInsensitiveLike_ShouldMatchString(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -96,9 +100,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockAsPrefixString(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -126,9 +132,11 @@ func TestQuerySimple_WithCaseInsensitiveLikeString_ShouldMatchPrefixString(t *te }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -156,9 +164,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockAsSuffixString(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -186,9 +196,11 @@ func TestQuerySimple_WithCaseInsensitiveLikeString_ShouldMatchSuffixString(t *te }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -216,9 +228,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockExactString(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -246,9 +260,11 @@ func TestQuerySimple_WithCaseInsensitiveLikeString_ShouldMatchExactString(t *tes }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -276,12 +292,14 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockContainsStringMuplitpleResu }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", - }, - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -309,9 +327,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockHasStartAndEnd(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -339,7 +359,9 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockHasBoth(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -365,9 +387,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockHasEither(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -398,9 +422,11 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockPropNotSet(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_lt_datetime_test.go b/tests/integration/query/simple/with_filter/with_lt_datetime_test.go index 0d17607891..da6f60354e 100644 --- a/tests/integration/query/simple/with_filter/with_lt_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_lt_datetime_test.go @@ -38,9 +38,11 @@ func TestQuerySimpleWithDateTimeLTFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -69,7 +71,9 @@ func TestQuerySimpleWithDateTimeLTFilterBlockWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) diff --git a/tests/integration/query/simple/with_filter/with_lt_float_test.go b/tests/integration/query/simple/with_filter/with_lt_float_test.go index ef7b601fcd..84e3c6122a 100644 --- a/tests/integration/query/simple/with_filter/with_lt_float_test.go +++ b/tests/integration/query/simple/with_filter/with_lt_float_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithFloatLessThanFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimpleWithFloatLessThanFilterBlockWithGreaterIntValue(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -96,7 +100,9 @@ func TestQuerySimpleWithFloatLessThanFilterBlockWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) diff --git a/tests/integration/query/simple/with_filter/with_lt_int_test.go b/tests/integration/query/simple/with_filter/with_lt_int_test.go index d26ecdc5a4..12bf972938 100644 --- a/tests/integration/query/simple/with_filter/with_lt_int_test.go +++ b/tests/integration/query/simple/with_filter/with_lt_int_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithIntLessThanFilterBlockWithGreaterValue(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, }, }, } @@ -65,7 +67,9 @@ func TestQuerySimpleWithIntLessThanFilterBlockWithNullValue(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) diff --git a/tests/integration/query/simple/with_filter/with_ne_bool_test.go b/tests/integration/query/simple/with_filter/with_ne_bool_test.go index 4b68d73592..1f25203e89 100644 --- a/tests/integration/query/simple/with_filter/with_ne_bool_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_bool_test.go @@ -39,12 +39,14 @@ func TestQuerySimpleWithBoolNotEqualsTrueFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Fred", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Fred", + }, + { + "Name": "Bob", + }, }, }, } @@ -75,12 +77,14 @@ func TestQuerySimpleWithBoolNotEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Fred", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Fred", + }, }, }, } @@ -111,12 +115,14 @@ func TestQuerySimpleWithBoolNotEqualsFalseFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_datetime_test.go b/tests/integration/query/simple/with_filter/with_ne_datetime_test.go index 11acb8629c..f6423ed95c 100644 --- a/tests/integration/query/simple/with_filter/with_ne_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_datetime_test.go @@ -38,9 +38,11 @@ func TestQuerySimpleWithDateTimeNotEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -74,12 +76,14 @@ func TestQuerySimpleWithDateTimeNotEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_float_test.go b/tests/integration/query/simple/with_filter/with_ne_float_test.go index fc742547c6..6e8e04175f 100644 --- a/tests/integration/query/simple/with_filter/with_ne_float_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_float_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithFloatNotEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -69,12 +71,14 @@ func TestQuerySimpleWithFloatNotEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_int_test.go b/tests/integration/query/simple/with_filter/with_ne_int_test.go index 7f61063eed..543af47d31 100644 --- a/tests/integration/query/simple/with_filter/with_ne_int_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_int_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithIntNotEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, }, }, } @@ -69,12 +71,14 @@ func TestQuerySimpleWithIntNotEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_string_test.go b/tests/integration/query/simple/with_filter/with_ne_string_test.go index b052e89e89..141e9b6d78 100644 --- a/tests/integration/query/simple/with_filter/with_ne_string_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_string_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithStringNotEqualsFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + }, }, }, } @@ -69,12 +71,14 @@ func TestQuerySimpleWithStringNotEqualsNilFilterBlock(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(21), - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + }, + { + "Age": int64(32), + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_nin_test.go b/tests/integration/query/simple/with_filter/with_nin_test.go index 9993847c0e..bd0f1b7333 100644 --- a/tests/integration/query/simple/with_filter/with_nin_test.go +++ b/tests/integration/query/simple/with_filter/with_nin_test.go @@ -47,12 +47,14 @@ func TestQuerySimpleWithNotInFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + }, + { + "Name": "Bob", + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_nlike_string_test.go b/tests/integration/query/simple/with_filter/with_nlike_string_test.go index 14526d39e2..7c07b785ae 100644 --- a/tests/integration/query/simple/with_filter/with_nlike_string_test.go +++ b/tests/integration/query/simple/with_filter/with_nlike_string_test.go @@ -36,9 +36,11 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockContainsString(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -66,9 +68,11 @@ func TestQuerySimple_WithNotCaseInsensitiveLikeString_ShouldMatchString(t *testi }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -96,9 +100,11 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockAsPrefixString(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -126,9 +132,11 @@ func TestQuerySimple_WithNotCaseInsensitiveLikeString_ShouldMatchPrefixString(t }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -156,9 +164,11 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockAsSuffixString(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -186,9 +196,11 @@ func TestQuerySimple_WithNotCaseInsensitiveLikeString_ShouldMatchSuffixString(t }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -216,9 +228,11 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockExactString(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -246,9 +260,11 @@ func TestQuerySimple_WithNotCaseInsensitiveLikeString_MatchExactString(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -276,7 +292,9 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockContainsStringMuplitpleR }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -302,9 +320,11 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockHasStartAndEnd(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -332,9 +352,11 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockHasBoth(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, }, }, } @@ -362,12 +384,14 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockHasEither(t *testing.T) }`, }, }, - Results: []map[string]any{ - { - "Name": "Viserys I Targaryen, King of the Andals", - }, - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Viserys I Targaryen, King of the Andals", + }, + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, }, }, } @@ -398,12 +422,14 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockPropNotSet(t *testing.T) }`, }, }, - Results: []map[string]any{ - { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", - }, - { - "Name": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + }, + { + "Name": nil, + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_not_test.go b/tests/integration/query/simple/with_filter/with_not_test.go index 14fef0d155..6e9ffcc0da 100644 --- a/tests/integration/query/simple/with_filter/with_not_test.go +++ b/tests/integration/query/simple/with_filter/with_not_test.go @@ -45,18 +45,20 @@ func TestQuerySimple_WithNotEqualToXFilter_NoError(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } @@ -93,10 +95,12 @@ func TestQuerySimple_WithNotAndComparisonXFilter_NoError(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } @@ -133,14 +137,16 @@ func TestQuerySimple_WithNotEqualToXorYFilter_NoError(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, }, }, } @@ -177,7 +183,9 @@ func TestQuerySimple_WithEmptyNotFilter_ReturnError(t *testing.T) { }`, }, }, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -216,22 +224,24 @@ func TestQuerySimple_WithNotEqualToXAndNotYFilter_NoError(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_or_test.go b/tests/integration/query/simple/with_filter/with_or_test.go index 2c1ea68e94..6a913730c2 100644 --- a/tests/integration/query/simple/with_filter/with_or_test.go +++ b/tests/integration/query/simple/with_filter/with_or_test.go @@ -45,14 +45,16 @@ func TestQuerySimpleWithIntEqualToXOrYFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_average_count_test.go b/tests/integration/query/simple/with_group_average_count_test.go index b5f13fce1b..837b12d11c 100644 --- a/tests/integration/query/simple/with_group_average_count_test.go +++ b/tests/integration/query/simple/with_group_average_count_test.go @@ -47,16 +47,18 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerAverageA }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(35), - "_count": int(2), - }, - { - "Name": "Alice", - "_avg": float64(-19), - "_count": int(1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(35), + "_count": int(2), + }, + { + "Name": "Alice", + "_avg": float64(-19), + "_count": int(1), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_average_filter_test.go b/tests/integration/query/simple/with_group_average_filter_test.go index fa68f2d0e9..6f17370301 100644 --- a/tests/integration/query/simple/with_group_average_filter_test.go +++ b/tests/integration/query/simple/with_group_average_filter_test.go @@ -41,14 +41,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAverageWithFilt }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(33), - }, - { - "Name": "Alice", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(33), + }, + { + "Name": "Alice", + "_avg": float64(0), + }, }, }, } @@ -84,25 +86,27 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupAndChildAverageWithFilter( }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(33), - "_group": []map[string]any{ - { - "Age": int64(34), - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(33), + "_group": []map[string]any{ + { + "Age": int64(34), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(0), - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_avg": float64(0), + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -143,25 +147,27 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupAndChildAverageWithDateTim }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(33), - "_group": []map[string]any{ - { - "Age": int64(32), - }, - { - "Age": int64(34), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(33), + "_group": []map[string]any{ + { + "Age": int64(32), + }, + { + "Age": int64(34), + }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(0), - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_avg": float64(0), + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -199,20 +205,22 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupWithFilterAndChildAverageW }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(34), - "_group": []map[string]any{ - { - "Age": int64(34), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(34), + "_group": []map[string]any{ + { + "Age": int64(34), + }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(0), - "_group": []map[string]any{}, + { + "Name": "Alice", + "_avg": float64(0), + "_group": []map[string]any{}, + }, }, }, } @@ -251,20 +259,22 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupWithFilterAndChildAverageW }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(34), - "_group": []map[string]any{ - { - "Age": int64(34), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(34), + "_group": []map[string]any{ + { + "Age": int64(34), + }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(0), - "_group": []map[string]any{}, + { + "Name": "Alice", + "_avg": float64(0), + "_group": []map[string]any{}, + }, }, }, } @@ -300,22 +310,24 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupWithFilterAndChildAverageW }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(34), - "_group": []map[string]any{ - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(34), + "_group": []map[string]any{ + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(0), - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_avg": float64(0), + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -351,16 +363,18 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAveragesWithDif }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "A1": float64(33), - "A2": float64(0), - }, - { - "Name": "Alice", - "A1": float64(0), - "A2": float64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "A1": float64(33), + "A2": float64(0), + }, + { + "Name": "Alice", + "A1": float64(0), + "A2": float64(19), + }, }, }, } @@ -401,14 +415,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAverageWithFilt }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(31), - }, - { - "Name": "Alice", - "_avg": float64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(31), + }, + { + "Name": "Alice", + "_avg": float64(19), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_average_limit_offset_test.go b/tests/integration/query/simple/with_group_average_limit_offset_test.go index 935ca5cb78..110dcc8bfd 100644 --- a/tests/integration/query/simple/with_group_average_limit_offset_test.go +++ b/tests/integration/query/simple/with_group_average_limit_offset_test.go @@ -46,14 +46,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerAverageW }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(35), - }, - { - "Name": "Alice", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(35), + }, + { + "Name": "Alice", + "_avg": float64(0), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_average_limit_test.go b/tests/integration/query/simple/with_group_average_limit_test.go index bb28de8793..ca5b1b0d81 100644 --- a/tests/integration/query/simple/with_group_average_limit_test.go +++ b/tests/integration/query/simple/with_group_average_limit_test.go @@ -46,14 +46,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerAverageW }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(33), - }, - { - "Name": "Alice", - "_avg": float64(-19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(33), + }, + { + "Name": "Alice", + "_avg": float64(-19), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_average_sum_test.go b/tests/integration/query/simple/with_group_average_sum_test.go index 4a1851df67..4e00607986 100644 --- a/tests/integration/query/simple/with_group_average_sum_test.go +++ b/tests/integration/query/simple/with_group_average_sum_test.go @@ -58,38 +58,40 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfCountOfInt(t * }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": float64(62.5), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(28.5), - }, - { - "Verified": false, - "_avg": float64(34), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": float64(62.5), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(28.5), + }, + { + "Verified": false, + "_avg": float64(34), + }, }, }, - }, - { - "Name": "Carlo", - "_sum": float64(55), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(55), + { + "Name": "Carlo", + "_sum": float64(55), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(55), + }, }, }, - }, - { - "Name": "Alice", - "_sum": float64(19), - "_group": []map[string]any{ - { - "Verified": false, - "_avg": float64(19), + { + "Name": "Alice", + "_sum": float64(19), + "_group": []map[string]any{ + { + "Verified": false, + "_avg": float64(19), + }, }, }, }, @@ -130,16 +132,18 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerAverageA }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(35), - "_sum": int64(70), - }, - { - "Name": "Alice", - "_avg": float64(-19), - "_sum": int64(-19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(35), + "_sum": int64(70), + }, + { + "Name": "Alice", + "_avg": float64(-19), + "_sum": int64(-19), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_average_test.go b/tests/integration/query/simple/with_group_average_test.go index 91aacd3c8a..9afbef7a3e 100644 --- a/tests/integration/query/simple/with_group_average_test.go +++ b/tests/integration/query/simple/with_group_average_test.go @@ -48,7 +48,9 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerAverageO _avg(_group: {field: Age}) } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -80,14 +82,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerAverage( }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(35), - }, - { - "Name": "Alice", - "_avg": float64(-19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(35), + }, + { + "Name": "Alice", + "_avg": float64(-19), + }, }, }, } @@ -120,14 +124,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildNilAverage(t *t }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(32), - }, - { - "Name": "Alice", - "_avg": float64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(32), + }, + { + "Name": "Alice", + "_avg": float64(19), + }, }, }, } @@ -177,38 +183,40 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfI }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(31.25), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(28.5), - }, - { - "Verified": false, - "_avg": float64(34), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(31.25), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(28.5), + }, + { + "Verified": false, + "_avg": float64(34), + }, }, }, - }, - { - "Name": "Carlo", - "_avg": float64(55), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(55), + { + "Name": "Carlo", + "_avg": float64(55), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(55), + }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(19), - "_group": []map[string]any{ - { - "Verified": false, - "_avg": float64(19), + { + "Name": "Alice", + "_avg": float64(19), + "_group": []map[string]any{ + { + "Verified": false, + "_avg": float64(19), + }, }, }, }, @@ -242,14 +250,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildEmptyFloatAvera }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(1.855), - }, - { - "Name": "Alice", - "_avg": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(1.855), + }, + { + "Name": "Alice", + "_avg": float64(0), + }, }, }, } @@ -282,14 +292,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildFloatAverage(t }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_avg": float64(1.855), - }, - { - "Name": "Alice", - "_avg": float64(2.04), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_avg": float64(1.855), + }, + { + "Name": "Alice", + "_avg": float64(2.04), + }, }, }, } @@ -339,38 +351,40 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfF }`, }, }, - Results: []map[string]any{ - { - "Name": "Alice", - "_avg": float64(2.04), - "_group": []map[string]any{ - { - "Verified": false, - "_avg": float64(2.04), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Alice", + "_avg": float64(2.04), + "_group": []map[string]any{ + { + "Verified": false, + "_avg": float64(2.04), + }, }, }, - }, - { - "Name": "John", - "_avg": float64(1.9675000000000002), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(1.715), - }, - { - "Verified": false, - "_avg": float64(2.22), + { + "Name": "John", + "_avg": float64(1.9675000000000002), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(1.715), + }, + { + "Verified": false, + "_avg": float64(2.22), + }, }, }, - }, - { - "Name": "Carlo", - "_avg": float64(1.74), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(1.74), + { + "Name": "Carlo", + "_avg": float64(1.74), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(1.74), + }, }, }, }, @@ -431,64 +445,66 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfA }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_avg": float64(1.74), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(1.74), - "_group": []map[string]any{ - { - "Age": int64(55), - "_avg": float64(1.74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_avg": float64(1.74), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(1.74), + "_group": []map[string]any{ + { + "Age": int64(55), + "_avg": float64(1.74), + }, }, }, }, }, - }, - { - "Name": "Alice", - "_avg": float64(2.04), - "_group": []map[string]any{ - { - "Verified": false, - "_avg": float64(2.04), - "_group": []map[string]any{ - { - "Age": int64(19), - "_avg": float64(2.04), + { + "Name": "Alice", + "_avg": float64(2.04), + "_group": []map[string]any{ + { + "Verified": false, + "_avg": float64(2.04), + "_group": []map[string]any{ + { + "Age": int64(19), + "_avg": float64(2.04), + }, }, }, }, }, - }, - { - "Name": "John", - "_avg": float64(1.9675000000000002), - "_group": []map[string]any{ - { - "Verified": true, - "_avg": float64(1.715), - "_group": []map[string]any{ - { - "Age": int64(32), - "_avg": float64(1.61), - }, - { - "Age": int64(25), - "_avg": float64(1.82), + { + "Name": "John", + "_avg": float64(1.9675000000000002), + "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(1.715), + "_group": []map[string]any{ + { + "Age": int64(32), + "_avg": float64(1.61), + }, + { + "Age": int64(25), + "_avg": float64(1.82), + }, }, }, - }, - { - "Verified": false, - "_avg": float64(2.22), - "_group": []map[string]any{ - { - "Age": int64(34), - "_avg": float64(2.22), + { + "Verified": false, + "_avg": float64(2.22), + "_group": []map[string]any{ + { + "Age": int64(34), + "_avg": float64(2.22), + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_count_filter_test.go b/tests/integration/query/simple/with_group_count_filter_test.go index 18a60bedf9..9d2950b4e5 100644 --- a/tests/integration/query/simple/with_group_count_filter_test.go +++ b/tests/integration/query/simple/with_group_count_filter_test.go @@ -41,14 +41,16 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCountWithFilter }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 2, - }, - { - "Age": int64(19), - "_count": 0, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 2, + }, + { + "Age": int64(19), + "_count": 0, + }, }, }, } @@ -84,25 +86,27 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupAndChildCountWithFilter(t }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 2, - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 2, + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_count": 0, - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_count": 0, + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, @@ -140,20 +144,22 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithFilterAndChildCountWit }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 1, - "_group": []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 1, + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_count": 0, - "_group": []map[string]any{}, + { + "Age": int64(19), + "_count": 0, + "_group": []map[string]any{}, + }, }, }, } @@ -189,20 +195,22 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithFilterAndChildCountWit }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 2, - "_group": []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 2, + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_count": 0, - "_group": []map[string]any{}, + { + "Age": int64(19), + "_count": 0, + "_group": []map[string]any{}, + }, }, }, } @@ -236,16 +244,18 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCountsWithDiffe }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "C1": 2, - "C2": 0, - }, - { - "Age": int64(19), - "C1": 0, - "C2": 1, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "C1": 2, + "C2": 0, + }, + { + "Age": int64(19), + "C1": 0, + "C2": 1, + }, }, }, } diff --git a/tests/integration/query/simple/with_group_count_limit_offset_test.go b/tests/integration/query/simple/with_group_count_limit_offset_test.go index 015f76c30c..4fe00f25b9 100644 --- a/tests/integration/query/simple/with_group_count_limit_offset_test.go +++ b/tests/integration/query/simple/with_group_count_limit_offset_test.go @@ -41,14 +41,16 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCountWithLimitA }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 1, - }, - { - "Age": int64(19), - "_count": 0, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 1, + }, + { + "Age": int64(19), + "_count": 0, + }, }, }, } @@ -88,25 +90,27 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithLimitAndChildCountWith }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 1, - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 1, + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "Shahzad", + }, }, }, - }, - { - "Age": int64(19), - "_count": 0, - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_count": 0, + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_count_limit_test.go b/tests/integration/query/simple/with_group_count_limit_test.go index 1870e07bc2..7deae49208 100644 --- a/tests/integration/query/simple/with_group_count_limit_test.go +++ b/tests/integration/query/simple/with_group_count_limit_test.go @@ -41,14 +41,16 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCountWithLimit( }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 1, - }, - { - "Age": int64(19), - "_count": 1, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 1, + }, + { + "Age": int64(19), + "_count": 1, + }, }, }, } @@ -88,25 +90,27 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithLimitAndChildCountWith }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 1, - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "Shahzad", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 1, + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "Shahzad", + }, }, }, - }, - { - "Age": int64(19), - "_count": 1, - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_count": 1, + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_count_sum_test.go b/tests/integration/query/simple/with_group_count_sum_test.go index aab55c4002..7e26628591 100644 --- a/tests/integration/query/simple/with_group_count_sum_test.go +++ b/tests/integration/query/simple/with_group_count_sum_test.go @@ -58,38 +58,40 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfCount(t *testi }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": int64(3), - "_group": []map[string]any{ - { - "Verified": true, - "_count": int(2), - }, - { - "Verified": false, - "_count": int(1), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": int64(3), + "_group": []map[string]any{ + { + "Verified": true, + "_count": int(2), + }, + { + "Verified": false, + "_count": int(1), + }, }, }, - }, - { - "Name": "Carlo", - "_sum": int64(1), - "_group": []map[string]any{ - { - "Verified": true, - "_count": int(1), + { + "Name": "Carlo", + "_sum": int64(1), + "_group": []map[string]any{ + { + "Verified": true, + "_count": int(1), + }, }, }, - }, - { - "Name": "Alice", - "_sum": int64(1), - "_group": []map[string]any{ - { - "Verified": false, - "_count": int(1), + { + "Name": "Alice", + "_sum": int64(1), + "_group": []map[string]any{ + { + "Verified": false, + "_count": int(1), + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_count_test.go b/tests/integration/query/simple/with_group_count_test.go index 6f3fda8320..4f979f3dcb 100644 --- a/tests/integration/query/simple/with_group_count_test.go +++ b/tests/integration/query/simple/with_group_count_test.go @@ -90,14 +90,16 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCount(t *testin }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 2, - }, - { - "Age": int64(19), - "_count": 1, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 2, + }, + { + "Age": int64(19), + "_count": 1, + }, }, }, } @@ -114,7 +116,9 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCountOnEmptyCol _count(_group: {}) } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -148,25 +152,27 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupAndChildCount(t *testing.T }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_count": 2, - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_count": 2, + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_count": 1, - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_count": 1, + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, @@ -232,14 +238,16 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndAliasesChildCount(t }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "Count": 2, - }, - { - "Age": int64(19), - "Count": 1, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "Count": 2, + }, + { + "Age": int64(19), + "Count": 1, + }, }, }, } @@ -275,16 +283,18 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndDuplicatedAliasedChi }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "Count1": 2, - "Count2": 2, - }, - { - "Age": int64(19), - "Count1": 1, - "Count2": 1, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "Count1": 2, + "Count2": 2, + }, + { + "Age": int64(19), + "Count1": 1, + "Count2": 1, + }, }, }, } diff --git a/tests/integration/query/simple/with_group_doc_id_test.go b/tests/integration/query/simple/with_group_doc_id_test.go index f476b3c617..9529f7e3bd 100644 --- a/tests/integration/query/simple/with_group_doc_id_test.go +++ b/tests/integration/query/simple/with_group_doc_id_test.go @@ -44,18 +44,20 @@ func TestQuerySimpleWithGroupByWithGroupWithDocID(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(21), - "_group": []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(32), - "_group": []map[string]any{}, + { + "Age": int64(32), + "_group": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/query/simple/with_group_doc_ids_test.go b/tests/integration/query/simple/with_group_doc_ids_test.go index 72aa527b66..cafbb21481 100644 --- a/tests/integration/query/simple/with_group_doc_ids_test.go +++ b/tests/integration/query/simple/with_group_doc_ids_test.go @@ -49,21 +49,23 @@ func TestQuerySimpleWithGroupByWithGroupWithDocIDs(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(21), - "_group": []map[string]any{ - { - "Name": "Fred", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(21), + "_group": []map[string]any{ + { + "Name": "Fred", + }, + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(32), - "_group": []map[string]any{}, + { + "Age": int64(32), + "_group": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/query/simple/with_group_filter_test.go b/tests/integration/query/simple/with_group_filter_test.go index 919d4c311b..3e3b5f32fe 100644 --- a/tests/integration/query/simple/with_group_filter_test.go +++ b/tests/integration/query/simple/with_group_filter_test.go @@ -47,26 +47,28 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(32), + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{}, + { + "Name": "Alice", + "_group": []map[string]any{}, + }, }, }, } @@ -105,20 +107,22 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithParentFilter(t *testing. }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(32), + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(32), + }, }, }, }, @@ -156,12 +160,14 @@ func TestQuerySimpleWithGroupByStringWithUnrenderedGroupNumberWithParentFilter(t }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + }, + { + "Name": "John", + }, }, }, } @@ -214,35 +220,37 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanThenInnerNumberFilterT }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{}, - }, - { - "Verified": false, - "_group": []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{}, + }, + { + "Verified": false, + "_group": []map[string]any{}, + }, }, }, - }, - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{}, + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{}, + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Verified": false, - "_group": []map[string]any{}, + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Verified": false, + "_group": []map[string]any{}, + }, }, }, }, @@ -286,35 +294,37 @@ func TestQuerySimpleWithGroupByStringWithMultipleGroupNumberFilter(t *testing.T) }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "G1": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "G1": []map[string]any{ + { + "Age": int64(55), + }, }, + "G2": []map[string]any{}, }, - "G2": []map[string]any{}, - }, - { - "Name": "John", - "G1": []map[string]any{ - { - "Age": int64(32), + { + "Name": "John", + "G1": []map[string]any{ + { + "Age": int64(32), + }, }, - }, - "G2": []map[string]any{ - { - "Age": int64(25), + "G2": []map[string]any{ + { + "Age": int64(25), + }, }, }, - }, - { - "Name": "Alice", - "G1": []map[string]any{}, - "G2": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "G1": []map[string]any{}, + "G2": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_limit_offset_test.go b/tests/integration/query/simple/with_group_limit_offset_test.go index 0fea317d5a..ea4c2afc81 100644 --- a/tests/integration/query/simple/with_group_limit_offset_test.go +++ b/tests/integration/query/simple/with_group_limit_offset_test.go @@ -43,18 +43,20 @@ func TestQuerySimpleWithGroupByNumberWithGroupLimitAndOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_group": []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_group": []map[string]any{}, + { + "Age": int64(19), + "_group": []map[string]any{}, + }, }, }, } @@ -89,10 +91,12 @@ func TestQuerySimpleWithGroupByNumberWithLimitAndOffsetAndWithGroupLimitAndOffse }`, }, }, - Results: []map[string]any{ - { - "Age": int64(19), - "_group": []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(19), + "_group": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/query/simple/with_group_limit_test.go b/tests/integration/query/simple/with_group_limit_test.go index b5b53c3b81..2b7ac5d205 100644 --- a/tests/integration/query/simple/with_group_limit_test.go +++ b/tests/integration/query/simple/with_group_limit_test.go @@ -43,20 +43,22 @@ func TestQuerySimpleWithGroupByNumberWithGroupLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_group": []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_group": []map[string]any{ + { + "Name": "Bob", + }, }, }, - }, - { - "Age": int64(19), - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, @@ -96,33 +98,35 @@ func TestQuerySimpleWithGroupByNumberWithMultipleGroupsWithDifferentLimits(t *te }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "G1": []map[string]any{ - { - "Name": "Bob", - }, - }, - "G2": []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "G1": []map[string]any{ + { + "Name": "Bob", + }, }, - { - "Name": "John", + "G2": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "G1": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "G1": []map[string]any{ + { + "Name": "Alice", + }, }, - }, - "G2": []map[string]any{ - { - "Name": "Alice", + "G2": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, @@ -159,15 +163,17 @@ func TestQuerySimpleWithGroupByNumberWithLimitAndGroupWithHigherLimit(t *testing }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, }, @@ -208,20 +214,22 @@ func TestQuerySimpleWithGroupByNumberWithLimitAndGroupWithLowerLimit(t *testing. }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_group": []map[string]any{ - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_group": []map[string]any{ + { + "Name": "Bob", + }, }, }, - }, - { - "Age": int64(42), - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(42), + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_order_test.go b/tests/integration/query/simple/with_group_order_test.go index 29d7014b03..b1ace46918 100644 --- a/tests/integration/query/simple/with_group_order_test.go +++ b/tests/integration/query/simple/with_group_order_test.go @@ -47,31 +47,33 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupOrder(t *testing.T) }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, - }, - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, }, @@ -112,31 +114,33 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupOrderDescending(t * }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(32), - }, - { - "Age": int64(25), + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(32), + }, + { + "Age": int64(25), + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -177,31 +181,33 @@ func TestQuerySimpleWithGroupByStringAndOrderDescendingWithGroupNumberWithGroupO }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -254,52 +260,54 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanThenInnerOrderDescendi }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(32), - }, - { - "Age": int64(25), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(32), + }, + { + "Age": int64(25), + }, }, }, - }, - { - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(34), + { + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(34), + }, }, }, }, }, - }, - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(55), + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -356,52 +364,54 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndOrderAscendingThenI }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_group": []map[string]any{ - { - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(34), - }, - { - "Age": int64(25), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_group": []map[string]any{ + { + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(34), + }, + { + "Age": int64(25), + }, }, }, - }, - { - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(32), + { + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(32), + }, }, }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, }, - }, - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(55), + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_sum_filter_test.go b/tests/integration/query/simple/with_group_sum_filter_test.go index 15d6a89acb..cf9f8e3a0b 100644 --- a/tests/integration/query/simple/with_group_sum_filter_test.go +++ b/tests/integration/query/simple/with_group_sum_filter_test.go @@ -41,14 +41,16 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildSumWithFilter(t }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_sum": int64(64), - }, - { - "Age": int64(19), - "_sum": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_sum": int64(64), + }, + { + "Age": int64(19), + "_sum": int64(0), + }, }, }, } @@ -84,25 +86,27 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupAndChildSumWithFilter(t *t }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_sum": int64(64), - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_sum": int64(64), + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_sum": int64(0), - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_sum": int64(0), + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, @@ -140,20 +144,22 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithFilterAndChildSumWithM }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_sum": int64(32), - "_group": []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_sum": int64(32), + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_sum": int64(0), - "_group": []map[string]any{}, + { + "Age": int64(19), + "_sum": int64(0), + "_group": []map[string]any{}, + }, }, }, } @@ -189,20 +195,22 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithFilterAndChildSumWithD }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "_sum": int64(64), - "_group": []map[string]any{ - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "_sum": int64(64), + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_sum": int64(0), - "_group": []map[string]any{}, + { + "Age": int64(19), + "_sum": int64(0), + "_group": []map[string]any{}, + }, }, }, } @@ -236,16 +244,18 @@ func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildSumsWithDiffere }`, }, }, - Results: []map[string]any{ - { - "Age": int64(32), - "S1": int64(64), - "S2": int64(0), - }, - { - "Age": int64(19), - "S1": int64(0), - "S2": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(32), + "S1": int64(64), + "S2": int64(0), + }, + { + "Age": int64(19), + "S1": int64(0), + "S2": int64(19), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_sum_limit_offset_test.go b/tests/integration/query/simple/with_group_sum_limit_offset_test.go index 8f09e1a0e6..7ba181b3c5 100644 --- a/tests/integration/query/simple/with_group_sum_limit_offset_test.go +++ b/tests/integration/query/simple/with_group_sum_limit_offset_test.go @@ -46,14 +46,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerSumWithL }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": int64(70), - }, - { - "Name": "Alice", - "_sum": int64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": int64(70), + }, + { + "Name": "Alice", + "_sum": int64(0), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_sum_limit_test.go b/tests/integration/query/simple/with_group_sum_limit_test.go index 3d40ccd66c..eda7ea131b 100644 --- a/tests/integration/query/simple/with_group_sum_limit_test.go +++ b/tests/integration/query/simple/with_group_sum_limit_test.go @@ -46,14 +46,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerSumWithL }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": int64(66), - }, - { - "Name": "Alice", - "_sum": int64(-19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": int64(66), + }, + { + "Name": "Alice", + "_sum": int64(-19), + }, }, }, } diff --git a/tests/integration/query/simple/with_group_sum_test.go b/tests/integration/query/simple/with_group_sum_test.go index 8fd0ce6fb1..03bfb3e2de 100644 --- a/tests/integration/query/simple/with_group_sum_test.go +++ b/tests/integration/query/simple/with_group_sum_test.go @@ -48,7 +48,9 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerSumOnEmp _sum(_group: {field: Age}) } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, } executeTestCase(t, test) @@ -80,14 +82,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildIntegerSum(t *t }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": int64(70), - }, - { - "Name": "Alice", - "_sum": int64(-19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": int64(70), + }, + { + "Name": "Alice", + "_sum": int64(-19), + }, }, }, } @@ -120,14 +124,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildNilSum(t *testi }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": int64(32), - }, - { - "Name": "Alice", - "_sum": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": int64(32), + }, + { + "Name": "Alice", + "_sum": int64(19), + }, }, }, } @@ -177,38 +183,40 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfInt(t *te }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": int64(91), - "_group": []map[string]any{ - { - "Verified": true, - "_sum": int64(57), - }, - { - "Verified": false, - "_sum": int64(34), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": int64(91), + "_group": []map[string]any{ + { + "Verified": true, + "_sum": int64(57), + }, + { + "Verified": false, + "_sum": int64(34), + }, }, }, - }, - { - "Name": "Carlo", - "_sum": int64(55), - "_group": []map[string]any{ - { - "Verified": true, - "_sum": int64(55), + { + "Name": "Carlo", + "_sum": int64(55), + "_group": []map[string]any{ + { + "Verified": true, + "_sum": int64(55), + }, }, }, - }, - { - "Name": "Alice", - "_sum": int64(19), - "_group": []map[string]any{ - { - "Verified": false, - "_sum": int64(19), + { + "Name": "Alice", + "_sum": int64(19), + "_group": []map[string]any{ + { + "Verified": false, + "_sum": int64(19), + }, }, }, }, @@ -242,14 +250,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildEmptyFloatSum(t }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": float64(3.71), - }, - { - "Name": "Alice", - "_sum": float64(0), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": float64(3.71), + }, + { + "Name": "Alice", + "_sum": float64(0), + }, }, }, } @@ -282,14 +292,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildFloatSum(t *tes }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_sum": float64(3.71), - }, - { - "Name": "Alice", - "_sum": float64(2.04), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_sum": float64(3.71), + }, + { + "Name": "Alice", + "_sum": float64(2.04), + }, }, }, } @@ -339,38 +351,40 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfFloat(t * }`, }, }, - Results: []map[string]any{ - { - "Name": "Alice", - "_sum": float64(2.04), - "_group": []map[string]any{ - { - "Verified": false, - "_sum": float64(2.04), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Alice", + "_sum": float64(2.04), + "_group": []map[string]any{ + { + "Verified": false, + "_sum": float64(2.04), + }, }, }, - }, - { - "Name": "John", - "_sum": float64(5.65), - "_group": []map[string]any{ - { - "Verified": true, - "_sum": float64(3.43), - }, - { - "Verified": false, - "_sum": float64(2.22), + { + "Name": "John", + "_sum": float64(5.65), + "_group": []map[string]any{ + { + "Verified": true, + "_sum": float64(3.43), + }, + { + "Verified": false, + "_sum": float64(2.22), + }, }, }, - }, - { - "Name": "Carlo", - "_sum": float64(1.74), - "_group": []map[string]any{ - { - "Verified": true, - "_sum": float64(1.74), + { + "Name": "Carlo", + "_sum": float64(1.74), + "_group": []map[string]any{ + { + "Verified": true, + "_sum": float64(1.74), + }, }, }, }, @@ -431,64 +445,66 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfSumOfFloa }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_sum": float64(1.74), - "_group": []map[string]any{ - { - "Verified": true, - "_sum": float64(1.74), - "_group": []map[string]any{ - { - "Age": int64(55), - "_sum": float64(1.74), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_sum": float64(1.74), + "_group": []map[string]any{ + { + "Verified": true, + "_sum": float64(1.74), + "_group": []map[string]any{ + { + "Age": int64(55), + "_sum": float64(1.74), + }, }, }, }, }, - }, - { - "Name": "Alice", - "_sum": float64(2.04), - "_group": []map[string]any{ - { - "Verified": false, - "_sum": float64(2.04), - "_group": []map[string]any{ - { - "Age": int64(19), - "_sum": float64(2.04), + { + "Name": "Alice", + "_sum": float64(2.04), + "_group": []map[string]any{ + { + "Verified": false, + "_sum": float64(2.04), + "_group": []map[string]any{ + { + "Age": int64(19), + "_sum": float64(2.04), + }, }, }, }, }, - }, - { - "Name": "John", - "_sum": float64(5.65), - "_group": []map[string]any{ - { - "Verified": true, - "_sum": float64(3.43), - "_group": []map[string]any{ - { - "Age": int64(32), - "_sum": float64(1.61), - }, - { - "Age": int64(25), - "_sum": float64(1.82), + { + "Name": "John", + "_sum": float64(5.65), + "_group": []map[string]any{ + { + "Verified": true, + "_sum": float64(3.43), + "_group": []map[string]any{ + { + "Age": int64(32), + "_sum": float64(1.61), + }, + { + "Age": int64(25), + "_sum": float64(1.82), + }, }, }, - }, - { - "Verified": false, - "_sum": float64(2.22), - "_group": []map[string]any{ - { - "Age": int64(34), - "_sum": float64(2.22), + { + "Verified": false, + "_sum": float64(2.22), + "_group": []map[string]any{ + { + "Age": int64(34), + "_sum": float64(2.22), + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_test.go b/tests/integration/query/simple/with_group_test.go index a12ecd0668..7b71ebf90f 100644 --- a/tests/integration/query/simple/with_group_test.go +++ b/tests/integration/query/simple/with_group_test.go @@ -38,14 +38,16 @@ func TestQuerySimpleWithGroupByEmpty(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, }, @@ -83,15 +85,17 @@ func TestQuerySimpleWithGroupByNumber(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(55), - }, - { - "Age": int64(32), - }, - { - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(55), + }, + { + "Age": int64(32), + }, + { + "Age": int64(19), + }, }, }, } @@ -127,15 +131,17 @@ func TestQuerySimpleWithGroupByDateTime(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "CreatedAt": testUtils.MustParseTime("2011-07-23T03:46:56-05:00"), - }, - { - "CreatedAt": testUtils.MustParseTime("2013-07-23T03:46:56-05:00"), - }, - { - "CreatedAt": testUtils.MustParseTime("2012-07-23T03:46:56-05:00"), + Results: map[string]any{ + "Users": []map[string]any{ + { + "CreatedAt": testUtils.MustParseTime("2011-07-23T03:46:56-05:00"), + }, + { + "CreatedAt": testUtils.MustParseTime("2013-07-23T03:46:56-05:00"), + }, + { + "CreatedAt": testUtils.MustParseTime("2012-07-23T03:46:56-05:00"), + }, }, }, } @@ -174,31 +180,33 @@ func TestQuerySimpleWithGroupByNumberWithGroupString(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": int64(55), - "_group": []map[string]any{ - { - "Name": "Carlo", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": int64(55), + "_group": []map[string]any{ + { + "Name": "Carlo", + }, }, }, - }, - { - "Age": int64(32), - "_group": []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + { + "Age": int64(32), + "_group": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, - }, - { - "Age": int64(19), - "_group": []map[string]any{ - { - "Name": "Alice", + { + "Age": int64(19), + "_group": []map[string]any{ + { + "Name": "Alice", + }, }, }, }, @@ -239,31 +247,33 @@ func TestQuerySimpleWithGroupByWithoutGroupedFieldSelectedWithInnerGroup(t *test }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -304,31 +314,33 @@ func TestQuerySimpleWithGroupByString(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "John", - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + { + "Name": "John", + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -381,52 +393,54 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBoolean(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(34), + { + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(34), + }, }, }, }, }, - }, - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(55), + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, }, }, - }, - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -479,43 +493,45 @@ func TestQuerySimpleWithGroupByStringThenBoolean(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "John", - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(34), + { + "Name": "John", + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(34), + }, }, }, - }, - { - "Name": "Carlo", - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(55), + { + "Name": "Carlo", + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "Alice", - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -566,43 +582,45 @@ func TestQuerySimpleWithGroupByBooleanThenNumber(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(25), - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(25), + }, + { + "Age": int64(32), + }, }, }, - }, - { - "Name": "John", - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(34), + { + "Name": "John", + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(34), + }, }, }, - }, - { - "Name": "Carlo", - "Verified": true, - "_group": []map[string]any{ - { - "Age": int64(55), + { + "Name": "Carlo", + "Verified": true, + "_group": []map[string]any{ + { + "Age": int64(55), + }, }, }, - }, - { - "Name": "Alice", - "Verified": false, - "_group": []map[string]any{ - { - "Age": int64(19), + { + "Name": "Alice", + "Verified": false, + "_group": []map[string]any{ + { + "Age": int64(19), + }, }, }, }, @@ -634,12 +652,14 @@ func TestQuerySimpleWithGroupByNumberOnUndefined(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": nil, - }, - { - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": nil, + }, + { + "Age": int64(32), + }, }, }, } @@ -672,23 +692,25 @@ func TestQuerySimpleWithGroupByNumberOnUndefinedWithChildren(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Age": nil, - "_group": []map[string]any{ - { - "Name": "Alice", - }, - { - "Name": "Bob", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Age": nil, + "_group": []map[string]any{ + { + "Name": "Alice", + }, + { + "Name": "Bob", + }, }, }, - }, - { - "Age": int64(32), - "_group": []map[string]any{ - { - "Name": "John", + { + "Age": int64(32), + "_group": []map[string]any{ + { + "Name": "John", + }, }, }, }, diff --git a/tests/integration/query/simple/with_group_typename_test.go b/tests/integration/query/simple/with_group_typename_test.go index 7da1001c74..d8179fc755 100644 --- a/tests/integration/query/simple/with_group_typename_test.go +++ b/tests/integration/query/simple/with_group_typename_test.go @@ -32,10 +32,12 @@ func TestQuerySimpleWithGroupByWithTypeName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "__typename": "Users", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "__typename": "Users", + }, }, }, } @@ -61,12 +63,14 @@ func TestQuerySimpleWithGroupByWithChildTypeName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_group": []map[string]any{ - { - "__typename": "Users", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_group": []map[string]any{ + { + "__typename": "Users", + }, }, }, }, diff --git a/tests/integration/query/simple/with_limit_offset_test.go b/tests/integration/query/simple/with_limit_offset_test.go index 21e02f049c..458fc91cc9 100644 --- a/tests/integration/query/simple/with_limit_offset_test.go +++ b/tests/integration/query/simple/with_limit_offset_test.go @@ -36,12 +36,14 @@ func TestQuerySimpleWithLimit0(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", - }, - { - "Name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + }, + { + "Name": "John", + }, }, }, } @@ -71,10 +73,12 @@ func TestQuerySimpleWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Bob", - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Bob", + "Age": int64(32), + }, }, }, }, @@ -106,14 +110,16 @@ func TestQuerySimpleWithLimit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Bob", - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Bob", + "Age": int64(32), + }, }, }, }, @@ -146,10 +152,12 @@ func TestQuerySimpleWithLimitAndOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -181,14 +189,16 @@ func TestQuerySimpleWithLimitAndOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, }, @@ -221,10 +231,12 @@ func TestQuerySimpleWithOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, }, }, }, @@ -260,18 +272,20 @@ func TestQuerySimpleWithOffset(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Melynda", - "Age": int64(30), - }, - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Melynda", + "Age": int64(30), + }, + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, }, diff --git a/tests/integration/query/simple/with_multiple_types_test.go b/tests/integration/query/simple/with_multiple_types_test.go index e46b03db28..6a8eb6dcfa 100644 --- a/tests/integration/query/simple/with_multiple_types_test.go +++ b/tests/integration/query/simple/with_multiple_types_test.go @@ -70,9 +70,11 @@ func TestSimple_WithSevenDummyTypesBefore(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -131,9 +133,11 @@ func TestSimple_WithEightDummyTypesBefore(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -195,9 +199,11 @@ func TestSimple_WithEightDummyTypesBeforeInSplitDeclaration(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -256,9 +262,11 @@ func TestSimple_WithEightDummyTypesAfter(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -318,9 +326,11 @@ func TestSimple_WithSevenDummyTypesBeforeAndOneAfter(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "User": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/query/simple/with_operation_alias_test.go b/tests/integration/query/simple/with_operation_alias_test.go new file mode 100644 index 0000000000..5a1130c523 --- /dev/null +++ b/tests/integration/query/simple/with_operation_alias_test.go @@ -0,0 +1,49 @@ +// Copyright 2024 Democratized Data Foundation +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package simple + +import ( + "testing" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestQuerySimpleWithOperationAlias(t *testing.T) { + test := testUtils.RequestTestCase{ + Description: "Simple query with operation alias", + Request: `query { + allUsers: Users { + _docID + Name + Age + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "John", + "Age": 21 + }`, + }, + }, + Results: map[string]any{ + "allUsers": []map[string]any{ + { + "_docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", + "Name": "John", + "Age": int64(21), + }, + }, + }, + } + + executeTestCase(t, test) +} diff --git a/tests/integration/query/simple/with_order_filter_test.go b/tests/integration/query/simple/with_order_filter_test.go index d65a197f2c..cbee236ca2 100644 --- a/tests/integration/query/simple/with_order_filter_test.go +++ b/tests/integration/query/simple/with_order_filter_test.go @@ -45,14 +45,16 @@ func TestQuerySimpleWithNumericGreaterThanFilterAndNumericOrderDescending(t *tes }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Bob", - "Age": int64(32), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Bob", + "Age": int64(32), + }, }, }, } diff --git a/tests/integration/query/simple/with_order_test.go b/tests/integration/query/simple/with_order_test.go index 1bd56574f9..003b9a0a52 100644 --- a/tests/integration/query/simple/with_order_test.go +++ b/tests/integration/query/simple/with_order_test.go @@ -41,18 +41,20 @@ func TestQuerySimpleWithEmptyOrder(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "John", - "Age": int64(21), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "John", + "Age": int64(21), + }, }, }, } @@ -89,22 +91,24 @@ func TestQuerySimpleWithNumericOrderAscending(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Alice", - "Age": int64(19), - }, - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "Carlo", - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Alice", + "Age": int64(19), + }, + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "Carlo", + "Age": int64(55), + }, }, }, } @@ -145,22 +149,24 @@ func TestQuerySimpleWithDateTimeOrderAscending(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Alice", - "Age": int64(19), - }, - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "Carlo", - "Age": int64(55), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Alice", + "Age": int64(19), + }, + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "Carlo", + "Age": int64(55), + }, }, }, } @@ -197,22 +203,24 @@ func TestQuerySimpleWithNumericOrderDescending(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } @@ -253,22 +261,24 @@ func TestQuerySimpleWithDateTimeOrderDescending(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - }, - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "John", - "Age": int64(21), - }, - { - "Name": "Alice", - "Age": int64(19), + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, + { + "Name": "Bob", + "Age": int64(32), + }, + { + "Name": "John", + "Age": int64(21), + }, + { + "Name": "Alice", + "Age": int64(19), + }, }, }, } @@ -310,26 +320,28 @@ func TestQuerySimpleWithNumericOrderDescendingAndBooleanOrderAscending(t *testin }`, }, }, - Results: []map[string]any{ - { - "Name": "Carlo", - "Age": int64(55), - "Verified": true, - }, - { - "Name": "Bob", - "Age": int64(21), - "Verified": false, - }, - { - "Name": "John", - "Age": int64(21), - "Verified": true, - }, - { - "Name": "Alice", - "Age": int64(19), - "Verified": false, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + "Verified": true, + }, + { + "Name": "Bob", + "Age": int64(21), + "Verified": false, + }, + { + "Name": "John", + "Age": int64(21), + "Verified": true, + }, + { + "Name": "Alice", + "Age": int64(19), + "Verified": false, + }, }, }, } diff --git a/tests/integration/query/simple/with_restart_test.go b/tests/integration/query/simple/with_restart_test.go index 0991f55c23..5d225bfad8 100644 --- a/tests/integration/query/simple/with_restart_test.go +++ b/tests/integration/query/simple/with_restart_test.go @@ -43,10 +43,12 @@ func TestQuerySimpleWithRestart(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "Shahzad", - "age": int64(30), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "age": int64(30), + }, }, }, }, diff --git a/tests/integration/query/simple/with_sum_filter_test.go b/tests/integration/query/simple/with_sum_filter_test.go index d02990ecea..1c1515a769 100644 --- a/tests/integration/query/simple/with_sum_filter_test.go +++ b/tests/integration/query/simple/with_sum_filter_test.go @@ -38,10 +38,8 @@ func TestQuerySimpleWithSumWithFilter(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_sum": int64(62), - }, + Results: map[string]any{ + "_sum": int64(62), }, } diff --git a/tests/integration/query/simple/with_sum_test.go b/tests/integration/query/simple/with_sum_test.go index 812faf6995..34dde00e15 100644 --- a/tests/integration/query/simple/with_sum_test.go +++ b/tests/integration/query/simple/with_sum_test.go @@ -46,10 +46,8 @@ func TestQuerySimpleWithSumOnEmptyCollection(t *testing.T) { Request: `query { _sum(Users: {field: Age}) }`, - Results: []map[string]any{ - { - "_sum": int64(0), - }, + Results: map[string]any{ + "_sum": int64(0), }, } @@ -74,10 +72,8 @@ func TestQuerySimpleWithSum(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "_sum": int64(51), - }, + Results: map[string]any{ + "_sum": int64(51), }, } diff --git a/tests/integration/query/simple/with_typename_test.go b/tests/integration/query/simple/with_typename_test.go index fb7a5e0bb8..8f44ee60c0 100644 --- a/tests/integration/query/simple/with_typename_test.go +++ b/tests/integration/query/simple/with_typename_test.go @@ -32,10 +32,12 @@ func TestQuerySimpleWithTypeName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "__typename": "Users", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "__typename": "Users", + }, }, }, } @@ -60,11 +62,13 @@ func TestQuerySimpleWithAliasedTypeName(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "__typename": "Users", - "t1": "Users", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "__typename": "Users", + "t1": "Users", + }, }, }, } diff --git a/tests/integration/query/simple/with_version_test.go b/tests/integration/query/simple/with_version_test.go index 732c1b6f1a..aaf2092e61 100644 --- a/tests/integration/query/simple/with_version_test.go +++ b/tests/integration/query/simple/with_version_test.go @@ -40,21 +40,23 @@ func TestQuerySimpleWithEmbeddedLatestCommit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - "_version": []map[string]any{ - { - "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", - "links": []map[string]any{ - { - "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", - "name": "Age", - }, - { - "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", - "name": "Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + "_version": []map[string]any{ + { + "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", + "links": []map[string]any{ + { + "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", + "name": "Age", + }, + { + "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", + "name": "Name", + }, }, }, }, @@ -85,12 +87,14 @@ func TestQuerySimpleWithEmbeddedLatestCommitWithSchemaVersionID(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_version": []map[string]any{ - { - "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_version": []map[string]any{ + { + "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", + }, }, }, }, @@ -122,13 +126,15 @@ func TestQuerySimpleWithEmbeddedLatestCommitWithDocID(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "_docID": docID, - "_version": []map[string]any{ - { - "docID": docID, + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_docID": docID, + "_version": []map[string]any{ + { + "docID": docID, + }, }, }, }, @@ -165,29 +171,31 @@ func TestQuerySimpleWithMultipleAliasedEmbeddedLatestCommit(t *testing.T) { }`, }, }, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(21), - "_version": []map[string]any{ - { - "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", - "L1": []map[string]any{ - { - "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", - "name": "Age", - }, - { - "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", - "name": "Name", - }, - }, - "L2": []map[string]any{ - { - "name": "Age", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(21), + "_version": []map[string]any{ + { + "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", + "L1": []map[string]any{ + { + "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", + "name": "Age", + }, + { + "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", + "name": "Name", + }, }, - { - "name": "Name", + "L2": []map[string]any{ + { + "name": "Age", + }, + { + "name": "Name", + }, }, }, }, @@ -236,30 +244,32 @@ func TestQuery_WithAllCommitFields_NoError(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "Name": "John", - "_docID": docID, - "_version": []map[string]any{ - { - "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", - "collectionID": int64(1), - "delta": nil, - "docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", - "fieldId": "C", - "fieldName": nil, - "height": int64(1), - "links": []map[string]any{ - { - "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", - "name": "Age", - }, - { - "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", - "name": "Name", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "_docID": docID, + "_version": []map[string]any{ + { + "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", + "collectionID": int64(1), + "delta": nil, + "docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", + "fieldId": "C", + "fieldName": nil, + "height": int64(1), + "links": []map[string]any{ + { + "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", + "name": "Age", + }, + { + "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", + "name": "Name", + }, }, + "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", }, - "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", }, }, }, @@ -314,51 +324,53 @@ func TestQuery_WithAllCommitFieldsWithUpdate_NoError(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "Name": "John", - "Age": int64(22), - "_docID": docID, - "_version": []map[string]any{ - { - "cid": "bafyreigfstknvmsl77pg443lqqf2g64y7hr575tts5c4nxuzk3dynffkem", - "collectionID": int64(1), - "delta": nil, - "docID": docID, - "fieldId": "C", - "fieldName": nil, - "height": int64(2), - "links": []map[string]any{ - { - "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", - "name": "_head", - }, - { - "cid": "bafyreiapjg22e47sanhjtqgu453mvmxcfcl4ksrcoctyfl6nfsh3xwfcvm", - "name": "Age", + Results: map[string]any{ + "Users": []map[string]any{ + { + "Name": "John", + "Age": int64(22), + "_docID": docID, + "_version": []map[string]any{ + { + "cid": "bafyreigfstknvmsl77pg443lqqf2g64y7hr575tts5c4nxuzk3dynffkem", + "collectionID": int64(1), + "delta": nil, + "docID": docID, + "fieldId": "C", + "fieldName": nil, + "height": int64(2), + "links": []map[string]any{ + { + "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", + "name": "_head", + }, + { + "cid": "bafyreiapjg22e47sanhjtqgu453mvmxcfcl4ksrcoctyfl6nfsh3xwfcvm", + "name": "Age", + }, }, + "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", }, - "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", - }, - { - "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", - "collectionID": int64(1), - "delta": nil, - "docID": docID, - "fieldId": "C", - "fieldName": nil, - "height": int64(1), - "links": []map[string]any{ - { - "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", - "name": "Age", - }, - { - "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", - "name": "Name", + { + "cid": "bafyreiby7drdzfsg4wwo7f6vkdqhurbe74s4lhayn3k3226zvkgwjd2fbu", + "collectionID": int64(1), + "delta": nil, + "docID": docID, + "fieldId": "C", + "fieldName": nil, + "height": int64(1), + "links": []map[string]any{ + { + "cid": "bafyreid4sasigytiflrh3rupyevo6wy43b6mlfi4jwkjjwvohgjcd3oscu", + "name": "Age", + }, + { + "cid": "bafyreieg3p2kpyxwiowskvb3pp35nedzawmapjuib7glrvszcgmv6z37fm", + "name": "Name", + }, }, + "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", }, - "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", }, }, }, diff --git a/tests/integration/schema/migrations/query/simple_test.go b/tests/integration/schema/migrations/query/simple_test.go index 4e0ca20f2b..584933946e 100644 --- a/tests/integration/schema/migrations/query/simple_test.go +++ b/tests/integration/schema/migrations/query/simple_test.go @@ -67,10 +67,12 @@ func TestSchemaMigrationQuery(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -137,18 +139,20 @@ func TestSchemaMigrationQueryMultipleDocs(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Islam", - "verified": true, - }, - { - "name": "Fred", - "verified": true, - }, - { - "name": "Shahzad", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Islam", + "verified": true, + }, + { + "name": "Fred", + "verified": true, + }, + { + "name": "Shahzad", + "verified": true, + }, }, }, }, @@ -207,10 +211,12 @@ func TestSchemaMigrationQueryWithMigrationRegisteredBeforeSchemaPatch(t *testing verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -277,11 +283,13 @@ func TestSchemaMigrationQueryMigratesToIntermediaryVersion(t *testing.T) { email } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, - "email": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + "email": nil, + }, }, }, }, @@ -348,11 +356,13 @@ func TestSchemaMigrationQueryMigratesFromIntermediaryVersion(t *testing.T) { email } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, - "email": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + "email": nil, + }, }, }, }, @@ -434,11 +444,13 @@ func TestSchemaMigrationQueryMigratesAcrossMultipleVersions(t *testing.T) { email } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, - "email": "ilovewasm@source.com", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + "email": "ilovewasm@source.com", + }, }, }, }, @@ -520,11 +532,13 @@ func TestSchemaMigrationQueryMigratesAcrossMultipleVersionsBeforePatches(t *test email } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, - "email": "ilovewasm@source.com", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + "email": "ilovewasm@source.com", + }, }, }, }, @@ -607,11 +621,13 @@ func TestSchemaMigrationQueryMigratesAcrossMultipleVersionsBeforePatchesWrongOrd email } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, - "email": "ilovewasm@source.com", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + "email": "ilovewasm@source.com", + }, }, }, }, @@ -674,10 +690,12 @@ func TestSchemaMigrationQueryWithUnknownSchemaMigration(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": nil, + }, }, }, }, @@ -736,9 +754,11 @@ func TestSchemaMigrationQueryMigrationMutatesExistingScalarField(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Fred", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + }, }, }, }, @@ -797,9 +817,11 @@ func TestSchemaMigrationQueryMigrationMutatesExistingInlineArrayField(t *testing mobile } }`, - Results: []map[string]any{ - { - "mobile": []int64{847, 723, 2012}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "mobile": []int64{847, 723, 2012}, + }, }, }, }, @@ -857,10 +879,12 @@ func TestSchemaMigrationQueryMigrationRemovesExistingField(t *testing.T) { age } }`, - Results: []map[string]any{ - { - "name": "John", - "age": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "age": nil, + }, }, }, }, @@ -918,9 +942,11 @@ func TestSchemaMigrationQueryMigrationPreservesExistingFieldWhenFieldNotRequeste name } }`, - Results: []map[string]any{ - { - "name": "Fred", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + }, }, }, }, @@ -931,10 +957,12 @@ func TestSchemaMigrationQueryMigrationPreservesExistingFieldWhenFieldNotRequeste age } }`, - Results: []map[string]any{ - { - "name": "Fred", - "age": int64(40), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + "age": int64(40), + }, }, }, }, @@ -993,10 +1021,12 @@ func TestSchemaMigrationQueryMigrationCopiesExistingFieldWhenSrcFieldNotRequeste yearsLived } }`, - Results: []map[string]any{ - { - "name": "John", - "yearsLived": int64(40), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "yearsLived": int64(40), + }, }, }, }, @@ -1054,9 +1084,11 @@ func TestSchemaMigrationQueryMigrationCopiesExistingFieldWhenSrcAndDstFieldNotRe name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -1068,11 +1100,13 @@ func TestSchemaMigrationQueryMigrationCopiesExistingFieldWhenSrcAndDstFieldNotRe yearsLived } }`, - Results: []map[string]any{ - { - "name": "John", - "age": int64(40), - "yearsLived": int64(40), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "age": int64(40), + "yearsLived": int64(40), + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_doc_id_test.go b/tests/integration/schema/migrations/query/with_doc_id_test.go index 2bd34a6fd4..bb28b90ac8 100644 --- a/tests/integration/schema/migrations/query/with_doc_id_test.go +++ b/tests/integration/schema/migrations/query/with_doc_id_test.go @@ -74,10 +74,12 @@ func TestSchemaMigrationQueryByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Shahzad", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "verified": true, + }, }, }, }, @@ -180,10 +182,12 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Shahzad", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "verified": true, + }, }, }, }, @@ -194,10 +198,12 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Fred", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + "verified": true, + }, }, }, }, @@ -208,10 +214,12 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Chris", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Chris", + "verified": true, + }, }, }, }, @@ -222,10 +230,12 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -236,10 +246,12 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Islam", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Islam", + "verified": true, + }, }, }, }, @@ -250,10 +262,12 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Dave", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Dave", + "verified": true, + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_inverse_test.go b/tests/integration/schema/migrations/query/with_inverse_test.go index 11c83c5fd4..3324637d7d 100644 --- a/tests/integration/schema/migrations/query/with_inverse_test.go +++ b/tests/integration/schema/migrations/query/with_inverse_test.go @@ -99,11 +99,13 @@ func TestSchemaMigrationQueryInversesAcrossMultipleVersions(t *testing.T) { height } }`, - Results: []map[string]any{ - { - "name": "John", - "age": nil, - "height": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "age": nil, + "height": nil, + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_p2p_schema_branch_test.go b/tests/integration/schema/migrations/query/with_p2p_schema_branch_test.go index d7dc9f10dd..a1f207f3a8 100644 --- a/tests/integration/schema/migrations/query/with_p2p_schema_branch_test.go +++ b/tests/integration/schema/migrations/query/with_p2p_schema_branch_test.go @@ -102,10 +102,12 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocOnOtherSchemaBranch(t *testing. verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -121,13 +123,15 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocOnOtherSchemaBranch(t *testing. } } `, - Results: []map[string]any{ - { - // name has been cleared by the inverse of the migration from version 1 to 2 - "name": nil, - // phone has been set by the migration from version 1 to 3 - "phone": "1234567890", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + // name has been cleared by the inverse of the migration from version 1 to 2 + "name": nil, + // phone has been set by the migration from version 1 to 3 + "phone": "1234567890", + "verified": true, + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_p2p_test.go b/tests/integration/schema/migrations/query/with_p2p_test.go index 39adf5a5a8..b320bb28f4 100644 --- a/tests/integration/schema/migrations/query/with_p2p_test.go +++ b/tests/integration/schema/migrations/query/with_p2p_test.go @@ -82,9 +82,11 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtOlderSchemaVersion(t *testing name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -97,11 +99,13 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtOlderSchemaVersion(t *testing verified } }`, - Results: []map[string]any{ - { - "name": "John", - // John has been migrated up to the newer schema version on node 1 - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // John has been migrated up to the newer schema version on node 1 + "verified": true, + }, }, }, }, @@ -199,9 +203,11 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtMuchOlderSchemaVersion(t *tes name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -214,11 +220,13 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtMuchOlderSchemaVersion(t *tes verified } }`, - Results: []map[string]any{ - { - "name": "Fred", - // John has been migrated up to the newer schema version on node 1 - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Fred", + // John has been migrated up to the newer schema version on node 1 + "verified": true, + }, }, }, }, @@ -290,10 +298,12 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtNewerSchemaVersion(t *testing verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -306,12 +316,14 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtNewerSchemaVersion(t *testing verified } }`, - Results: []map[string]any{ - { - "name": "John", - // John has been migrated down to the older schema version on node 1 - // clearing the verified field - "verified": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // John has been migrated down to the older schema version on node 1 + // clearing the verified field + "verified": nil, + }, }, }, }, @@ -389,9 +401,11 @@ func TestSchemaMigrationQueryWithP2PReplicatedDocAtMuchNewerSchemaVersionWithSch name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_restart_test.go b/tests/integration/schema/migrations/query/with_restart_test.go index 4f2c0f4ec7..e468249e60 100644 --- a/tests/integration/schema/migrations/query/with_restart_test.go +++ b/tests/integration/schema/migrations/query/with_restart_test.go @@ -68,10 +68,12 @@ func TestSchemaMigrationQueryWithRestart(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -129,10 +131,12 @@ func TestSchemaMigrationQueryWithRestartAndMigrationBeforeSchemaPatch(t *testing verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_schema_branch_test.go b/tests/integration/schema/migrations/query/with_schema_branch_test.go index 0ed9e68aca..d3bf7b2960 100644 --- a/tests/integration/schema/migrations/query/with_schema_branch_test.go +++ b/tests/integration/schema/migrations/query/with_schema_branch_test.go @@ -92,12 +92,14 @@ func TestSchemaMigrationQuery_WithBranchingSchema(t *testing.T) { } } `, - Results: []map[string]any{ - { - // name has been cleared by the inverse of the migration from version 1 to 2 - "name": nil, - // phone has been set by the migration from version 1 to 3 - "phone": "1234567890", + Results: map[string]any{ + "Users": []map[string]any{ + { + // name has been cleared by the inverse of the migration from version 1 to 2 + "name": nil, + // phone has been set by the migration from version 1 to 3 + "phone": "1234567890", + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_set_default_test.go b/tests/integration/schema/migrations/query/with_set_default_test.go index 170a861d89..22865d3173 100644 --- a/tests/integration/schema/migrations/query/with_set_default_test.go +++ b/tests/integration/schema/migrations/query/with_set_default_test.go @@ -69,10 +69,12 @@ func TestSchemaMigrationQuery_WithSetDefaultToLatest_AppliesForwardMigration(t * verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -143,11 +145,13 @@ func TestSchemaMigrationQuery_WithSetDefaultToOriginal_AppliesInverseMigration(t verified } }`, - Results: []map[string]any{ - { - "name": "John", - // The inverse lens migration has been applied, clearing the verified field - "verified": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // The inverse lens migration has been applied, clearing the verified field + "verified": nil, + }, }, }, }, @@ -215,11 +219,13 @@ func TestSchemaMigrationQuery_WithSetDefaultToOriginalVersionThatDocWasCreatedAt verified } }`, - Results: []map[string]any{ - { - "name": "John", - // The inverse lens migration has not been applied, the document is returned as it was defined - "verified": false, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // The inverse lens migration has not been applied, the document is returned as it was defined + "verified": false, + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_txn_test.go b/tests/integration/schema/migrations/query/with_txn_test.go index 79d2d9e825..3dc5044720 100644 --- a/tests/integration/schema/migrations/query/with_txn_test.go +++ b/tests/integration/schema/migrations/query/with_txn_test.go @@ -70,10 +70,12 @@ func TestSchemaMigrationQueryWithTxn(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, @@ -135,10 +137,12 @@ func TestSchemaMigrationQueryWithTxnAndCommit(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "John", - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "verified": true, + }, }, }, }, diff --git a/tests/integration/schema/migrations/query/with_update_test.go b/tests/integration/schema/migrations/query/with_update_test.go index bbeabcd062..ce9132ba85 100644 --- a/tests/integration/schema/migrations/query/with_update_test.go +++ b/tests/integration/schema/migrations/query/with_update_test.go @@ -67,12 +67,14 @@ func TestSchemaMigrationQueryWithUpdateRequest(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Johnnnn", - // We need to assert that the migration has been run within the context - // of the update - "verified": true, + Results: map[string]any{ + "update_Users": []map[string]any{ + { + "name": "Johnnnn", + // We need to assert that the migration has been run within the context + // of the update + "verified": true, + }, }, }, }, @@ -83,12 +85,14 @@ func TestSchemaMigrationQueryWithUpdateRequest(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Johnnnn", - // We need to assert that the effects of the migration executed within the - // update have been persisted - "verified": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Johnnnn", + // We need to assert that the effects of the migration executed within the + // update have been persisted + "verified": true, + }, }, }, }, @@ -151,12 +155,14 @@ func TestSchemaMigrationQueryWithMigrationRegisteredAfterUpdate(t *testing.T) { verified } }`, - Results: []map[string]any{ - { - "name": "Johnnnn", - // As the document was updated before the migration was registered - // the migration will not have been run - "verified": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Johnnnn", + // As the document was updated before the migration was registered + // the migration will not have been run + "verified": nil, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/crdt/lww_test.go b/tests/integration/schema/updates/add/field/crdt/lww_test.go index 5d75d4db6e..44444f5aa3 100644 --- a/tests/integration/schema/updates/add/field/crdt/lww_test.go +++ b/tests/integration/schema/updates/add/field/crdt/lww_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldCRDTLWW(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/field/crdt/none_test.go b/tests/integration/schema/updates/add/field/crdt/none_test.go index c49faa3904..002320115f 100644 --- a/tests/integration/schema/updates/add/field/crdt/none_test.go +++ b/tests/integration/schema/updates/add/field/crdt/none_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldCRDTDefault(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -73,7 +75,9 @@ func TestSchemaUpdatesAddFieldCRDTNone(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/field/crdt/pcounter_test.go b/tests/integration/schema/updates/add/field/crdt/pcounter_test.go index b7edfe7269..0614311fe2 100644 --- a/tests/integration/schema/updates/add/field/crdt/pcounter_test.go +++ b/tests/integration/schema/updates/add/field/crdt/pcounter_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdates_AddFieldCRDTPCounter_NoError(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/field/crdt/pncounter_test.go b/tests/integration/schema/updates/add/field/crdt/pncounter_test.go index e4be1c1df8..788f0aff65 100644 --- a/tests/integration/schema/updates/add/field/crdt/pncounter_test.go +++ b/tests/integration/schema/updates/add/field/crdt/pncounter_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdates_AddFieldCRDTPNCounter_NoError(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/field/create_test.go b/tests/integration/schema/updates/add/field/create_test.go index 32f10b1a60..85ded26b12 100644 --- a/tests/integration/schema/updates/add/field/create_test.go +++ b/tests/integration/schema/updates/add/field/create_test.go @@ -48,11 +48,13 @@ func TestSchemaUpdatesAddFieldWithCreate(t *testing.T) { email } }`, - Results: []map[string]any{ - { - "_docID": "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc", - "name": "John", - "email": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "_docID": "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc", + "name": "John", + "email": nil, + }, }, }, }, @@ -102,14 +104,16 @@ func TestSchemaUpdatesAddFieldWithCreateAfterSchemaUpdate(t *testing.T) { email } }`, - Results: []map[string]any{ - { - "name": "Shahzad", - "email": "sqlizded@yahoo.ca", - }, - { - "name": "John", - "email": nil, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Shahzad", + "email": "sqlizded@yahoo.ca", + }, + { + "name": "John", + "email": nil, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/create_update_test.go b/tests/integration/schema/updates/add/field/create_update_test.go index 53b892e0ae..12d8523460 100644 --- a/tests/integration/schema/updates/add/field/create_update_test.go +++ b/tests/integration/schema/updates/add/field/create_update_test.go @@ -47,12 +47,14 @@ func TestSchemaUpdatesAddFieldWithCreateWithUpdateAfterSchemaUpdateAndVersionJoi } } }`, - Results: []map[string]any{ - { - "name": "John", - "_version": []map[string]any{ - { - "schemaVersionId": initialSchemaVersionID, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "_version": []map[string]any{ + { + "schemaVersionId": initialSchemaVersionID, + }, }, }, }, @@ -82,18 +84,20 @@ func TestSchemaUpdatesAddFieldWithCreateWithUpdateAfterSchemaUpdateAndVersionJoi } } }`, - Results: []map[string]any{ - { - "name": "John", - "email": "ih8oraclelicensing@netscape.net", - "_version": []map[string]any{ - { - // Update commit - "schemaVersionId": updatedSchemaVersionID, - }, - { - // Create commit - "schemaVersionId": initialSchemaVersionID, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "email": "ih8oraclelicensing@netscape.net", + "_version": []map[string]any{ + { + // Update commit + "schemaVersionId": updatedSchemaVersionID, + }, + { + // Create commit + "schemaVersionId": initialSchemaVersionID, + }, }, }, }, @@ -144,14 +148,16 @@ func TestSchemaUpdatesAddFieldWithCreateWithUpdateAfterSchemaUpdateAndCommitQuer schemaVersionId } }`, - Results: []map[string]any{ - { - // Update commit - "schemaVersionId": updatedSchemaVersionID, - }, - { - // Create commit - "schemaVersionId": initialSchemaVersionID, + Results: map[string]any{ + "commits": []map[string]any{ + { + // Update commit + "schemaVersionId": updatedSchemaVersionID, + }, + { + // Create commit + "schemaVersionId": initialSchemaVersionID, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/blob_test.go b/tests/integration/schema/updates/add/field/kind/blob_test.go index badbdc56fe..c4bd3c1d2e 100644 --- a/tests/integration/schema/updates/add/field/kind/blob_test.go +++ b/tests/integration/schema/updates/add/field/kind/blob_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindBlob(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindBlobWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "00ff", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "00ff", + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindBlobSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "00ff", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "00ff", + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/bool_array_test.go b/tests/integration/schema/updates/add/field/kind/bool_array_test.go index 64df51a18c..7f1664a30d 100644 --- a/tests/integration/schema/updates/add/field/kind/bool_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/bool_array_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindBoolArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindBoolArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []bool{true, false, true}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []bool{true, false, true}, + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindBoolArraySubstitutionWithCreate(t *testing.T) foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []bool{true, false, true}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []bool{true, false, true}, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/bool_nil_array_test.go b/tests/integration/schema/updates/add/field/kind/bool_nil_array_test.go index 899d0cba36..b6de79d1f9 100644 --- a/tests/integration/schema/updates/add/field/kind/bool_nil_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/bool_nil_array_test.go @@ -43,7 +43,9 @@ func TestSchemaUpdatesAddFieldKindNillableBoolArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -82,10 +84,12 @@ func TestSchemaUpdatesAddFieldKindNillableBoolArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[bool]{immutable.Some(true), immutable.Some(false), immutable.None[bool]()}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[bool]{immutable.Some(true), immutable.Some(false), immutable.None[bool]()}, + }, }, }, }, @@ -126,10 +130,12 @@ func TestSchemaUpdatesAddFieldKindNillableBoolArraySubstitutionWithCreate(t *tes foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[bool]{immutable.Some(true), immutable.Some(false), immutable.None[bool]()}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[bool]{immutable.Some(true), immutable.Some(false), immutable.None[bool]()}, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/bool_test.go b/tests/integration/schema/updates/add/field/kind/bool_test.go index c77d187dbb..a06f111237 100644 --- a/tests/integration/schema/updates/add/field/kind/bool_test.go +++ b/tests/integration/schema/updates/add/field/kind/bool_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindBool(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindBoolWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": true, + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindBoolSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": true, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": true, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/datetime_test.go b/tests/integration/schema/updates/add/field/kind/datetime_test.go index a9ee10a2de..662ae96919 100644 --- a/tests/integration/schema/updates/add/field/kind/datetime_test.go +++ b/tests/integration/schema/updates/add/field/kind/datetime_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindDateTime(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindDateTimeWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": testUtils.MustParseTime("2017-07-23T03:46:56-05:00"), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": testUtils.MustParseTime("2017-07-23T03:46:56-05:00"), + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindDateTimeSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": testUtils.MustParseTime("2017-07-23T03:46:56-05:00"), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": testUtils.MustParseTime("2017-07-23T03:46:56-05:00"), + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/doc_id_test.go b/tests/integration/schema/updates/add/field/kind/doc_id_test.go index edac43150f..be62192a1f 100644 --- a/tests/integration/schema/updates/add/field/kind/doc_id_test.go +++ b/tests/integration/schema/updates/add/field/kind/doc_id_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindDocID(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindDocIDWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "nhgfdsfd", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "nhgfdsfd", + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindDocIDSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "nhgfdsfd", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "nhgfdsfd", + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/float_array_test.go b/tests/integration/schema/updates/add/field/kind/float_array_test.go index dcf9fd3d42..76d4c2fa67 100644 --- a/tests/integration/schema/updates/add/field/kind/float_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/float_array_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindFloatArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindFloatArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []float64{3.1, -8.1, 0}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []float64{3.1, -8.1, 0}, + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindFloatArraySubstitutionWithCreate(t *testing.T) foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []float64{3.1, -8.1, 0}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []float64{3.1, -8.1, 0}, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/float_nil_array_test.go b/tests/integration/schema/updates/add/field/kind/float_nil_array_test.go index 9dd4209a38..721dfcc3db 100644 --- a/tests/integration/schema/updates/add/field/kind/float_nil_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/float_nil_array_test.go @@ -43,7 +43,9 @@ func TestSchemaUpdatesAddFieldKindNillableFloatArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -82,13 +84,15 @@ func TestSchemaUpdatesAddFieldKindNillableFloatArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[float64]{ - immutable.Some(3.14), - immutable.Some(-5.77), - immutable.None[float64](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[float64]{ + immutable.Some(3.14), + immutable.Some(-5.77), + immutable.None[float64](), + }, }, }, }, @@ -130,13 +134,15 @@ func TestSchemaUpdatesAddFieldKindNillableFloatArraySubstitutionWithCreate(t *te foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[float64]{ - immutable.Some(3.14), - immutable.Some(-5.77), - immutable.None[float64](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[float64]{ + immutable.Some(3.14), + immutable.Some(-5.77), + immutable.None[float64](), + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/float_test.go b/tests/integration/schema/updates/add/field/kind/float_test.go index b145d4c148..12c97bb107 100644 --- a/tests/integration/schema/updates/add/field/kind/float_test.go +++ b/tests/integration/schema/updates/add/field/kind/float_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindFloat(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindFloatWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": float64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": float64(3), + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindFloatSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": float64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": float64(3), + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/foreign_object_test.go b/tests/integration/schema/updates/add/field/kind/foreign_object_test.go index 9b18500446..6b544d6713 100644 --- a/tests/integration/schema/updates/add/field/kind/foreign_object_test.go +++ b/tests/integration/schema/updates/add/field/kind/foreign_object_test.go @@ -163,15 +163,17 @@ func TestSchemaUpdatesAddFieldKindForeignObject_Succeeds(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": nil, - }, - { - "name": "Keenan", - "foo": map[string]any{ + Results: map[string]any{ + "Users": []map[string]any{ + { "name": "John", + "foo": nil, + }, + { + "name": "Keenan", + "foo": map[string]any{ + "name": "John", + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/int_array_test.go b/tests/integration/schema/updates/add/field/kind/int_array_test.go index 9a6d9e69af..5d9d8a8342 100644 --- a/tests/integration/schema/updates/add/field/kind/int_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/int_array_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindIntArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindIntArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []int64{3, 5, 8}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []int64{3, 5, 8}, + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindIntArraySubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []int64{3, 5, 8}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []int64{3, 5, 8}, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/int_nil_array_test.go b/tests/integration/schema/updates/add/field/kind/int_nil_array_test.go index 0de26958bb..30e05f38ac 100644 --- a/tests/integration/schema/updates/add/field/kind/int_nil_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/int_nil_array_test.go @@ -43,7 +43,9 @@ func TestSchemaUpdatesAddFieldKindNillableIntArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -82,13 +84,15 @@ func TestSchemaUpdatesAddFieldKindNillableIntArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[int64]{ - immutable.Some[int64](3), - immutable.Some[int64](-5), - immutable.None[int64](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[int64]{ + immutable.Some[int64](3), + immutable.Some[int64](-5), + immutable.None[int64](), + }, }, }, }, @@ -130,13 +134,15 @@ func TestSchemaUpdatesAddFieldKindNillableIntArraySubstitutionWithCreate(t *test foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[int64]{ - immutable.Some[int64](3), - immutable.Some[int64](-5), - immutable.None[int64](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[int64]{ + immutable.Some[int64](3), + immutable.Some[int64](-5), + immutable.None[int64](), + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/int_test.go b/tests/integration/schema/updates/add/field/kind/int_test.go index 70b3294a84..0cf0011b87 100644 --- a/tests/integration/schema/updates/add/field/kind/int_test.go +++ b/tests/integration/schema/updates/add/field/kind/int_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindInt(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindIntWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": int64(3), + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindIntSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": int64(3), + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/json_test.go b/tests/integration/schema/updates/add/field/kind/json_test.go index 37e2886a58..371e12d074 100644 --- a/tests/integration/schema/updates/add/field/kind/json_test.go +++ b/tests/integration/schema/updates/add/field/kind/json_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindJSON(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindJSONWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "{}", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "{}", + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindJSONSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "{}", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "{}", + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/string_array_test.go b/tests/integration/schema/updates/add/field/kind/string_array_test.go index b035162aed..4da57d15e1 100644 --- a/tests/integration/schema/updates/add/field/kind/string_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/string_array_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindStringArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindStringArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []string{"bar", "pub", "inn", "out", "hokey", "cokey", "pepsi", "beer", "bar", "pub", "..."}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []string{"bar", "pub", "inn", "out", "hokey", "cokey", "pepsi", "beer", "bar", "pub", "..."}, + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindStringArraySubstitutionWithCreate(t *testing.T foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []string{"bar", "pub", "inn", "out", "hokey", "cokey", "pepsi", "beer", "bar", "pub", "..."}, + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []string{"bar", "pub", "inn", "out", "hokey", "cokey", "pepsi", "beer", "bar", "pub", "..."}, + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/string_nil_array_test.go b/tests/integration/schema/updates/add/field/kind/string_nil_array_test.go index 9fc750cc80..0cec4880a9 100644 --- a/tests/integration/schema/updates/add/field/kind/string_nil_array_test.go +++ b/tests/integration/schema/updates/add/field/kind/string_nil_array_test.go @@ -43,7 +43,9 @@ func TestSchemaUpdatesAddFieldKindNillableStringArray(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -82,13 +84,15 @@ func TestSchemaUpdatesAddFieldKindNillableStringArrayWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[string]{ - immutable.Some("hello"), - immutable.Some("پدر سگ"), - immutable.None[string](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[string]{ + immutable.Some("hello"), + immutable.Some("پدر سگ"), + immutable.None[string](), + }, }, }, }, @@ -130,13 +134,15 @@ func TestSchemaUpdatesAddFieldKindNillableStringArraySubstitutionWithCreate(t *t foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": []immutable.Option[string]{ - immutable.Some("hello"), - immutable.Some("پدر سگ"), - immutable.None[string](), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": []immutable.Option[string]{ + immutable.Some("hello"), + immutable.Some("پدر سگ"), + immutable.None[string](), + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/string_test.go b/tests/integration/schema/updates/add/field/kind/string_test.go index 336c2fe6de..dadb59d09f 100644 --- a/tests/integration/schema/updates/add/field/kind/string_test.go +++ b/tests/integration/schema/updates/add/field/kind/string_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldKindString(t *testing.T) { foo } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,10 +82,12 @@ func TestSchemaUpdatesAddFieldKindStringWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "bar", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "bar", + }, }, }, }, @@ -124,10 +128,12 @@ func TestSchemaUpdatesAddFieldKindStringSubstitutionWithCreate(t *testing.T) { foo } }`, - Results: []map[string]any{ - { - "name": "John", - "foo": "bar", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + "foo": "bar", + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/simple_test.go b/tests/integration/schema/updates/add/field/simple_test.go index d315791dfa..a958bea6a4 100644 --- a/tests/integration/schema/updates/add/field/simple_test.go +++ b/tests/integration/schema/updates/add/field/simple_test.go @@ -47,7 +47,9 @@ func TestSchemaUpdatesAddFieldSimple(t *testing.T) { email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.GetSchema{ VersionID: immutable.Some(schemaVersion2ID), @@ -195,7 +197,9 @@ func TestSchemaUpdatesAddFieldSimpleErrorsAddingToUnknownCollection(t *testing.T name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -229,7 +233,9 @@ func TestSchemaUpdatesAddFieldMultipleInPatch(t *testing.T) { city } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -269,7 +275,9 @@ func TestSchemaUpdatesAddFieldMultiplePatches(t *testing.T) { city } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -338,7 +346,9 @@ func TestSchemaUpdatesAddFieldMultipleInPatchPartialSuccess(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/field/with_filter_test.go b/tests/integration/schema/updates/add/field/with_filter_test.go index 6161d9a237..a1b4679a66 100644 --- a/tests/integration/schema/updates/add/field/with_filter_test.go +++ b/tests/integration/schema/updates/add/field/with_filter_test.go @@ -40,7 +40,9 @@ func TestSchemaUpdatesAddFieldSimpleWithFilter(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,9 +82,11 @@ func TestSchemaUpdatesAddFieldSimpleWithFilterOnPopulatedDatabase(t *testing.T) name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/schema/updates/add/field/with_index_sub_test.go b/tests/integration/schema/updates/add/field/with_index_sub_test.go index 274e3aac2b..3ddb4a1b9f 100644 --- a/tests/integration/schema/updates/add/field/with_index_sub_test.go +++ b/tests/integration/schema/updates/add/field/with_index_sub_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddFieldSimple_FieldIndexedByName(t *testing.T) { email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -73,7 +75,9 @@ func TestSchemaUpdatesAddFieldSimple_FieldIndexedByNameWithSameNameDefinedInValu email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -130,7 +134,9 @@ func TestSchemaUpdatesAddFieldSimple_FieldIndexedByNameMultipleTimes(t *testing. email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/field/with_index_test.go b/tests/integration/schema/updates/add/field/with_index_test.go index 52815789f8..e7981495f7 100644 --- a/tests/integration/schema/updates/add/field/with_index_test.go +++ b/tests/integration/schema/updates/add/field/with_index_test.go @@ -43,7 +43,9 @@ func TestSchemaUpdatesAddFieldSimple_WithExistingIndex(t *testing.T) { email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/add/simple_test.go b/tests/integration/schema/updates/add/simple_test.go index 65d04a7af6..18fbcdf138 100644 --- a/tests/integration/schema/updates/add/simple_test.go +++ b/tests/integration/schema/updates/add/simple_test.go @@ -41,7 +41,9 @@ func TestSchemaUpdatesAddSimpleErrorsAddingSchema(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -121,7 +123,9 @@ func TestSchemaUpdatesAddSimpleErrorsAddingUnsupportedCollectionProp(t *testing. name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -153,7 +157,9 @@ func TestSchemaUpdatesAddSimpleErrorsAddingUnsupportedSchemaProp(t *testing.T) { name } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/copy/field/simple_test.go b/tests/integration/schema/updates/copy/field/simple_test.go index 5baf640ab8..1e380fbd7c 100644 --- a/tests/integration/schema/updates/copy/field/simple_test.go +++ b/tests/integration/schema/updates/copy/field/simple_test.go @@ -43,7 +43,9 @@ func TestSchemaUpdatesCopyFieldErrors(t *testing.T) { email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -80,7 +82,9 @@ func TestSchemaUpdatesCopyFieldWithAndReplaceName(t *testing.T) { fax } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } @@ -124,11 +128,13 @@ func TestSchemaUpdatesCopyFieldWithReplaceNameAndKindSubstitution(t *testing.T) age } }`, - Results: []map[string]any{ - { - "name": "John", - // It is important to test this with data, to ensure the type has been substituted correctly - "age": int64(3), + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "John", + // It is important to test this with data, to ensure the type has been substituted correctly + "age": int64(3), + }, }, }, }, diff --git a/tests/integration/schema/updates/move/simple_test.go b/tests/integration/schema/updates/move/simple_test.go index 9898430e0f..1053438aa7 100644 --- a/tests/integration/schema/updates/move/simple_test.go +++ b/tests/integration/schema/updates/move/simple_test.go @@ -58,9 +58,11 @@ func TestSchemaUpdatesMoveCollectionDoesNothing(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Johnnn", + Results: map[string]any{ + "Users": []map[string]any{ + { + "name": "Johnnn", + }, }, }, }, @@ -71,14 +73,16 @@ func TestSchemaUpdatesMoveCollectionDoesNothing(t *testing.T) { schemaVersionId } }`, - Results: []map[string]any{ - { - // Update commit - "schemaVersionId": schemaVersionID, - }, - { - // Create commit - "schemaVersionId": schemaVersionID, + Results: map[string]any{ + "commits": []map[string]any{ + { + // Update commit + "schemaVersionId": schemaVersionID, + }, + { + // Create commit + "schemaVersionId": schemaVersionID, + }, }, }, }, diff --git a/tests/integration/schema/updates/remove/simple_test.go b/tests/integration/schema/updates/remove/simple_test.go index d0343484e5..6628ccde86 100644 --- a/tests/integration/schema/updates/remove/simple_test.go +++ b/tests/integration/schema/updates/remove/simple_test.go @@ -93,7 +93,9 @@ func TestSchemaUpdatesRemoveSchemaVersionIDErrors(t *testing.T) { email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/test/add_field_test.go b/tests/integration/schema/updates/test/add_field_test.go index 31eec344f2..f75acc7795 100644 --- a/tests/integration/schema/updates/test/add_field_test.go +++ b/tests/integration/schema/updates/test/add_field_test.go @@ -42,7 +42,9 @@ func TestSchemaUpdatesTestAddField(t *testing.T) { email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/schema/updates/with_schema_branch_test.go b/tests/integration/schema/updates/with_schema_branch_test.go index 58759f3edd..312cb34d2a 100644 --- a/tests/integration/schema/updates/with_schema_branch_test.go +++ b/tests/integration/schema/updates/with_schema_branch_test.go @@ -98,7 +98,9 @@ func TestSchemaUpdates_WithBranchingSchema(t *testing.T) { phone } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.GetSchema{ // The third schema version is present in the system, with the phone field @@ -220,7 +222,9 @@ func TestSchemaUpdates_WithPatchOnBranchedSchema(t *testing.T) { discordName } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.GetSchema{ // The fourth schema version is present in the system, with the phone and discordName field @@ -351,7 +355,9 @@ func TestSchemaUpdates_WithBranchingSchemaAndSetActiveSchemaToOtherBranch(t *tes } }`, // The email field is queriable - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.Request{ Request: `query { @@ -458,7 +464,9 @@ func TestSchemaUpdates_WithBranchingSchemaAndSetActiveSchemaToOtherBranchThenPat discordName } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, testUtils.GetSchema{ // The fourth schema version is present in the system, with the email and discordName field diff --git a/tests/integration/schema/with_update_set_default_test.go b/tests/integration/schema/with_update_set_default_test.go index 22f05a4d73..3cc2a7cf9a 100644 --- a/tests/integration/schema/with_update_set_default_test.go +++ b/tests/integration/schema/with_update_set_default_test.go @@ -138,7 +138,9 @@ func TestSchema_WithUpdateAndSetDefaultVersionToNew_AllowsQueryingOfNewField(t * email } }`, - Results: []map[string]any{}, + Results: map[string]any{ + "Users": []map[string]any{}, + }, }, }, } diff --git a/tests/integration/subscription/subscription_test.go b/tests/integration/subscription/subscription_test.go index dc7a91d7c6..1a844f6e16 100644 --- a/tests/integration/subscription/subscription_test.go +++ b/tests/integration/subscription/subscription_test.go @@ -28,19 +28,23 @@ func TestSubscriptionWithCreateMutations(t *testing.T) { age } }`, - Results: [][]map[string]any{ + Results: []map[string]any{ { - { - "_docID": "bae-b3ce089b-f543-5984-be9f-ad7d08969f4e", - "age": int64(27), - "name": "John", + "User": []map[string]any{ + { + "_docID": "bae-b3ce089b-f543-5984-be9f-ad7d08969f4e", + "age": int64(27), + "name": "John", + }, }, }, { - { - "_docID": "bae-bc20b854-10b3-5408-b28c-f273ddda9434", - "age": int64(31), - "name": "Addo", + "User": []map[string]any{ + { + "_docID": "bae-bc20b854-10b3-5408-b28c-f273ddda9434", + "age": int64(31), + "name": "Addo", + }, }, }, }, @@ -51,9 +55,11 @@ func TestSubscriptionWithCreateMutations(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -63,9 +69,11 @@ func TestSubscriptionWithCreateMutations(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Addo", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "name": "Addo", + }, }, }, }, @@ -86,11 +94,13 @@ func TestSubscriptionWithFilterAndOneCreateMutation(t *testing.T) { age } }`, - Results: [][]map[string]any{ + Results: []map[string]any{ { - { - "age": int64(27), - "name": "John", + "User": []map[string]any{ + { + "age": int64(27), + "name": "John", + }, }, }, }, @@ -101,9 +111,11 @@ func TestSubscriptionWithFilterAndOneCreateMutation(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -125,7 +137,7 @@ func TestSubscriptionWithFilterAndOneCreateMutationOutsideFilter(t *testing.T) { age } }`, - Results: [][]map[string]any{}, + Results: []map[string]any{}, }, testUtils.Request{ Request: `mutation { @@ -133,9 +145,11 @@ func TestSubscriptionWithFilterAndOneCreateMutationOutsideFilter(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -156,11 +170,13 @@ func TestSubscriptionWithFilterAndCreateMutations(t *testing.T) { age } }`, - Results: [][]map[string]any{ + Results: []map[string]any{ { - { - "age": int64(27), - "name": "John", + "User": []map[string]any{ + { + "age": int64(27), + "name": "John", + }, }, }, }, @@ -171,9 +187,11 @@ func TestSubscriptionWithFilterAndCreateMutations(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -183,9 +201,11 @@ func TestSubscriptionWithFilterAndCreateMutations(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Addo", + Results: map[string]any{ + "create_User": []map[string]any{ + { + "name": "Addo", + }, }, }, }, @@ -225,12 +245,14 @@ func TestSubscriptionWithUpdateMutations(t *testing.T) { points } }`, - Results: [][]map[string]any{ + Results: []map[string]any{ { - { - "age": int64(27), - "name": "John", - "points": float64(45), + "User": []map[string]any{ + { + "age": int64(27), + "name": "John", + "points": float64(45), + }, }, }, }, @@ -241,9 +263,11 @@ func TestSubscriptionWithUpdateMutations(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "update_User": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -283,19 +307,23 @@ func TestSubscriptionWithUpdateAllMutations(t *testing.T) { points } }`, - Results: [][]map[string]any{ + Results: []map[string]any{ { - { - "age": int64(31), - "name": "Addo", - "points": float64(55), + "User": []map[string]any{ + { + "age": int64(31), + "name": "Addo", + "points": float64(55), + }, }, }, { - { - "age": int64(27), - "name": "John", - "points": float64(55), + "User": []map[string]any{ + { + "age": int64(27), + "name": "John", + "points": float64(55), + }, }, }, }, @@ -306,12 +334,14 @@ func TestSubscriptionWithUpdateAllMutations(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Addo", - }, - { - "name": "John", + Results: map[string]any{ + "update_User": []map[string]any{ + { + "name": "Addo", + }, + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/test_case.go b/tests/integration/test_case.go index a384318dd2..689b8cb815 100644 --- a/tests/integration/test_case.go +++ b/tests/integration/test_case.go @@ -487,13 +487,13 @@ type GetIndexes struct { // assertions. type ResultAsserter interface { // Assert will be called with the test and the result of the request. - Assert(t testing.TB, result []map[string]any) + Assert(t testing.TB, result map[string]any) } // ResultAsserterFunc is a function that can be used to implement the ResultAsserter -type ResultAsserterFunc func(testing.TB, []map[string]any) (bool, string) +type ResultAsserterFunc func(testing.TB, map[string]any) (bool, string) -func (f ResultAsserterFunc) Assert(t testing.TB, result []map[string]any) { +func (f ResultAsserterFunc) Assert(t testing.TB, result map[string]any) { f(t, result) } @@ -536,7 +536,7 @@ type Request struct { Request string // The expected (data) results of the issued request. - Results []map[string]any + Results map[string]any // Asserter is an optional custom result asserter. Asserter ResultAsserter @@ -616,7 +616,7 @@ type SubscriptionRequest struct { Request string // The expected (data) results yielded through the subscription across its lifetime. - Results [][]map[string]any + Results []map[string]any // Any error expected from the action. Optional. // diff --git a/tests/integration/utils.go b/tests/integration/utils.go index b530f45920..14f20b494d 100644 --- a/tests/integration/utils.go +++ b/tests/integration/utils.go @@ -22,7 +22,7 @@ type RequestTestCase struct { // of docs in stringified JSON format Docs map[int][]string - Results []map[string]any + Results map[string]any // The expected content of an expected error ExpectedError string diff --git a/tests/integration/utils2.go b/tests/integration/utils2.go index a9bd8aa4c3..f26ee4ed5b 100644 --- a/tests/integration/utils2.go +++ b/tests/integration/utils2.go @@ -1272,15 +1272,8 @@ func createDocViaGQL( strings.Join(action.EncryptedFields, ", ") + "]" } - req := fmt.Sprintf( - `mutation { - create_%s(%s) { - _docID - } - }`, - collection.Name().Value(), - params, - ) + key := fmt.Sprintf("create_%s", collection.Name().Value()) + req := fmt.Sprintf(`mutation { %s(%s) { _docID } }`, key, params) txn := getTransaction(s, node, immutable.None[int](), action.ExpectedError) ctx := db.SetContextIdentity(db.SetContextTxn(s.ctx, txn), getIdentity(s, nodeIndex, action.Identity)) @@ -1290,13 +1283,11 @@ func createDocViaGQL( return nil, result.GQL.Errors[0] } - resultantDocs, ok := result.GQL.Data.([]map[string]any) - if !ok || len(resultantDocs) == 0 { - return nil, nil - } + resultData := result.GQL.Data.(map[string]any) + resultDocs := ConvertToArrayOfMaps(s.t, resultData[key]) - docIDs := make([]client.DocID, len(resultantDocs)) - for i, docMap := range resultantDocs { + docIDs := make([]client.DocID, len(resultDocs)) + for i, docMap := range resultDocs { docIDString := docMap[request.DocIDFieldName].(string) docID, err := client.NewDocIDFromString(docIDString) require.NoError(s.t, err) @@ -1842,7 +1833,7 @@ type docFieldKey struct { func assertRequestResults( s *state, result *client.GQLResult, - expectedResults []map[string]any, + expectedResults map[string]any, expectedError string, asserter ResultAsserter, nodeID int, @@ -1858,16 +1849,51 @@ func assertRequestResults( } // Note: if result.Data == nil this panics (the panic seems useful while testing). - resultantData := result.Data.([]map[string]any) + resultantData := result.Data.(map[string]any) + log.InfoContext(s.ctx, "", corelog.Any("RequestResults", result.Data)) if asserter != nil { asserter.Assert(s.t, resultantData) return true } - log.InfoContext(s.ctx, "", corelog.Any("RequestResults", result.Data)) + // merge all keys so we can check for missing values + keys := make(map[string]struct{}) + for key := range resultantData { + keys[key] = struct{}{} + } + for key := range expectedResults { + keys[key] = struct{}{} + } + + for key := range keys { + expect, ok := expectedResults[key] + require.True(s.t, ok, "expected key not found: %s", key) + + actual, ok := resultantData[key] + require.True(s.t, ok, "result key not found: %s", key) + + expectDocs, ok := expect.([]map[string]any) + if ok { + actualDocs := ConvertToArrayOfMaps(s.t, actual) + assertRequestResultDocs( + s, + nodeID, + expectDocs, + actualDocs, + anyOfByField) + } else { + assertResultsEqual( + s.t, + s.clientType, + expect, + actual, + fmt.Sprintf("node: %v, key: %v", nodeID, key), + ) + } + } - return assertRequestResultDocs(s, nodeID, expectedResults, resultantData, anyOfByField) + return false } func assertRequestResultDocs( @@ -1914,7 +1940,7 @@ func assertRequestResultDocs( fmt.Sprintf("node: %v, doc: %v", nodeID, actualDocIndex), ) case []map[string]any: - actualValueMap := convertToArrayOfMaps(s.t, actualValue) + actualValueMap := ConvertToArrayOfMaps(s.t, actualValue) assertRequestResultDocs( s, @@ -1939,7 +1965,7 @@ func assertRequestResultDocs( return false } -func convertToArrayOfMaps(t testing.TB, value any) []map[string]any { +func ConvertToArrayOfMaps(t testing.TB, value any) []map[string]any { valueArrayMap, ok := value.([]map[string]any) if ok { return valueArrayMap diff --git a/tests/integration/view/one_to_many/simple_test.go b/tests/integration/view/one_to_many/simple_test.go index 9c846b6ba0..2f66c6ee50 100644 --- a/tests/integration/view/one_to_many/simple_test.go +++ b/tests/integration/view/one_to_many/simple_test.go @@ -73,12 +73,14 @@ func TestView_OneToMany(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Harper Lee", - "books": []map[string]any{ - { - "name": "To Kill a Mockingbird", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "name": "Harper Lee", + "books": []map[string]any{ + { + "name": "To Kill a Mockingbird", + }, }, }, }, @@ -291,9 +293,11 @@ func TestView_OneToManyWithRelationInQueryButNotInSDL(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "Harper Lee", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "name": "Harper Lee", + }, }, }, }, @@ -439,12 +443,14 @@ func TestView_OneToManyWithDoubleSidedRelation_Errors(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "name": "Harper Lee", - "books": []map[string]any{ - { - "name": "To Kill a Mockingbird", + Results: map[string]any{ + "AuthorViewView": []map[string]any{ + { + "name": "Harper Lee", + "books": []map[string]any{ + { + "name": "To Kill a Mockingbird", + }, }, }, }, diff --git a/tests/integration/view/one_to_many/with_alias_test.go b/tests/integration/view/one_to_many/with_alias_test.go index bfd6e443d9..29101fbc63 100644 --- a/tests/integration/view/one_to_many/with_alias_test.go +++ b/tests/integration/view/one_to_many/with_alias_test.go @@ -73,12 +73,14 @@ func TestView_OneToManyWithAliasOnOuter(t *testing.T) { } } }`, - Results: []map[string]any{ - { - "fullName": "Harper Lee", - "books": []map[string]any{ - { - "name": "To Kill a Mockingbird", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "fullName": "Harper Lee", + "books": []map[string]any{ + { + "name": "To Kill a Mockingbird", + }, }, }, }, @@ -149,12 +151,14 @@ func TestView_OneToManyWithAliasOnInner(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Harper Lee", - "books": []map[string]any{ - { - "fullName": "To Kill a Mockingbird", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "name": "Harper Lee", + "books": []map[string]any{ + { + "fullName": "To Kill a Mockingbird", + }, }, }, }, diff --git a/tests/integration/view/one_to_many/with_count_test.go b/tests/integration/view/one_to_many/with_count_test.go index 2fa06d9aec..a679c53f6b 100644 --- a/tests/integration/view/one_to_many/with_count_test.go +++ b/tests/integration/view/one_to_many/with_count_test.go @@ -143,10 +143,12 @@ func TestView_OneToManyWithAliasedCount(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Harper Lee", - "numberOfBooks": 2, + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "name": "Harper Lee", + "numberOfBooks": 2, + }, }, }, }, @@ -199,9 +201,11 @@ func TestView_OneToManyWithCountInQueryButNotSDL(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Harper Lee", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "name": "Harper Lee", + }, }, }, }, diff --git a/tests/integration/view/one_to_many/with_transform_test.go b/tests/integration/view/one_to_many/with_transform_test.go index 13ef4f19c6..f0ceeee197 100644 --- a/tests/integration/view/one_to_many/with_transform_test.go +++ b/tests/integration/view/one_to_many/with_transform_test.go @@ -92,12 +92,14 @@ func TestView_OneToManyWithTransformOnOuter(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fullName": "Ferdowsi", - "books": []any{ - map[string]any{ - "name": "Shahnameh", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "fullName": "Ferdowsi", + "books": []any{ + map[string]any{ + "name": "Shahnameh", + }, }, }, }, @@ -171,15 +173,17 @@ func TestView_OneToManyWithTransformAddingInnerDocs(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Ferdowsi", - "books": []any{ - map[string]any{ - "name": "The Tragedy of Sohrab and Rostam", - }, - map[string]any{ - "name": "The Legend of Seyavash", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "name": "Ferdowsi", + "books": []any{ + map[string]any{ + "name": "The Tragedy of Sohrab and Rostam", + }, + map[string]any{ + "name": "The Legend of Seyavash", + }, }, }, }, diff --git a/tests/integration/view/one_to_one/identical_schema_test.go b/tests/integration/view/one_to_one/identical_schema_test.go index ec83cd81cc..aab5cedbbf 100644 --- a/tests/integration/view/one_to_one/identical_schema_test.go +++ b/tests/integration/view/one_to_one/identical_schema_test.go @@ -77,11 +77,13 @@ func TestView_OneToOneSameSchema(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Left hand 1", - "heldBy": map[string]any{ - "name": "Right hand 1", + Results: map[string]any{ + "HandView": []map[string]any{ + { + "name": "Left hand 1", + "heldBy": map[string]any{ + "name": "Right hand 1", + }, }, }, }, diff --git a/tests/integration/view/one_to_one/with_transform_test.go b/tests/integration/view/one_to_one/with_transform_test.go index d4270b454d..8fcee174f3 100644 --- a/tests/integration/view/one_to_one/with_transform_test.go +++ b/tests/integration/view/one_to_one/with_transform_test.go @@ -92,11 +92,13 @@ func TestView_OneToOneWithTransformOnOuter(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fullName": "Ferdowsi", - "book": map[string]any{ - "name": "Shahnameh", + Results: map[string]any{ + "AuthorView": []map[string]any{ + { + "fullName": "Ferdowsi", + "book": map[string]any{ + "name": "Shahnameh", + }, }, }, }, diff --git a/tests/integration/view/simple/simple_test.go b/tests/integration/view/simple/simple_test.go index df9ef60379..df811a528f 100644 --- a/tests/integration/view/simple/simple_test.go +++ b/tests/integration/view/simple/simple_test.go @@ -50,9 +50,11 @@ func TestView_Simple(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -101,12 +103,14 @@ func TestView_SimpleMultipleDocs(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", - }, - { - "name": "Fred", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + }, + { + "name": "Fred", + }, }, }, }, @@ -198,9 +202,11 @@ func TestView_SimpleWithExtraFieldInViewSDL(t *testing.T) { name } }`, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -249,9 +255,11 @@ func TestView_SimpleWithExtraFieldInViewQuery(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -309,9 +317,11 @@ func TestView_SimpleViewOfView(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "UserViewView": []map[string]any{ + { + "name": "John", + }, }, }, }, diff --git a/tests/integration/view/simple/with_alias_test.go b/tests/integration/view/simple/with_alias_test.go index 0fd7e29db9..b7818e25be 100644 --- a/tests/integration/view/simple/with_alias_test.go +++ b/tests/integration/view/simple/with_alias_test.go @@ -52,9 +52,11 @@ func TestView_SimpleWithAlias(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fullname": "John", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "fullname": "John", + }, }, }, }, diff --git a/tests/integration/view/simple/with_filter_test.go b/tests/integration/view/simple/with_filter_test.go index a600a84729..58dfadc926 100644 --- a/tests/integration/view/simple/with_filter_test.go +++ b/tests/integration/view/simple/with_filter_test.go @@ -57,9 +57,11 @@ func TestView_SimpleWithFilter(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + }, }, }, }, @@ -122,10 +124,12 @@ func TestView_SimpleWithFilterOnViewAndQuery(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", - "age": 31, + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + "age": 31, + }, }, }, }, diff --git a/tests/integration/view/simple/with_transform_test.go b/tests/integration/view/simple/with_transform_test.go index b6d903a286..118d0b3991 100644 --- a/tests/integration/view/simple/with_transform_test.go +++ b/tests/integration/view/simple/with_transform_test.go @@ -76,12 +76,14 @@ func TestView_SimpleWithTransform(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fullName": "John", - }, - { - "fullName": "Fred", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "fullName": "John", + }, + { + "fullName": "Fred", + }, }, }, }, @@ -157,14 +159,16 @@ func TestView_SimpleWithMultipleTransforms(t *testing.T) { } } `, - Results: []map[string]any{ - { - "fullName": "John", - "age": 23, - }, - { - "fullName": "Fred", - "age": 23, + Results: map[string]any{ + "UserView": []map[string]any{ + { + "fullName": "John", + "age": 23, + }, + { + "fullName": "Fred", + "age": 23, + }, }, }, }, @@ -227,15 +231,17 @@ func TestView_SimpleWithTransformReturningMoreDocsThanInput(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "Fred", - }, - { - "name": "Shahzad", - }, - { - "name": "John", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "Fred", + }, + { + "name": "Shahzad", + }, + { + "name": "John", + }, }, }, }, @@ -307,12 +313,14 @@ func TestView_SimpleWithTransformReturningFewerDocsThanInput(t *testing.T) { } } `, - Results: []map[string]any{ - { - "name": "John", - }, - { - "name": "Shahzad", + Results: map[string]any{ + "UserView": []map[string]any{ + { + "name": "John", + }, + { + "name": "Shahzad", + }, }, }, },