Skip to content

Commit

Permalink
fixed issue #84
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Solender committed Jan 17, 2022
1 parent a21ccd4 commit 0f4c427
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,34 @@ func (integrationTest *IntegrationTestSuite) SetupSuite() {
integrationTest.gogm = gogm
}

func (integrationTest *IntegrationTestSuite) TestQueryRaw() {
sess, err := integrationTest.gogm.NewSessionV2(SessionConfig{AccessMode: AccessModeWrite})
integrationTest.Require().NotNil(sess)
integrationTest.Require().Nil(err)
ctx := context.Background()

err = sess.SaveDepth(ctx, &a{
Created: time.Now().UTC(),
}, 0)
integrationTest.Require().Nil(err)

// test outside tx
res, _, err := sess.QueryRaw(ctx, "match (n) return n", nil)
integrationTest.Require().Nil(err)
integrationTest.Require().NotEmpty(res)

// test in tx
err = sess.Begin(ctx)
integrationTest.Require().Nil(err)

res, _, err = sess.QueryRaw(ctx, "match (n) return n", nil)
integrationTest.Require().Nil(err)
integrationTest.Require().NotEmpty(res)

err = sess.Commit(ctx)
integrationTest.Require().Nil(err)
}

func (integrationTest *IntegrationTestSuite) TestV4Index() {
if integrationTest.gogm.neoVersion < 4 {
integrationTest.T().Log("skipping because of incompatible version", integrationTest.gogm.neoVersion)
Expand Down
4 changes: 3 additions & 1 deletion sessionv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,14 @@ func (s *SessionV2Impl) QueryRaw(ctx context.Context, query string, properties m
return nil, nil, fmt.Errorf("failed to execute query, %w", err)
}

parsedResult := s.parseResult(res)

sum, err := res.Consume()
if err != nil {
return nil, nil, err
}

return s.parseResult(res), sum, nil
return parsedResult, sum, nil
} else {
var ires interface{}
var sum neo4j.ResultSummary
Expand Down

0 comments on commit 0f4c427

Please sign in to comment.