forked from rethinkdb/rethinkdb-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery_test.go
50 lines (36 loc) · 1.03 KB
/
query_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package gorethink
import test "gopkg.in/check.v1"
func (s *RethinkSuite) TestQueryRun(c *test.C) {
var response string
res, err := Expr("Test").Run(session)
c.Assert(err, test.IsNil)
err = res.One(&response)
c.Assert(err, test.IsNil)
c.Assert(response, test.Equals, "Test")
}
func (s *RethinkSuite) TestQueryExec(c *test.C) {
err := Expr("Test").Exec(session)
c.Assert(err, test.IsNil)
}
func (s *RethinkSuite) TestQueryProfile(c *test.C) {
var response string
res, err := Expr("Test").Run(session, RunOpts{
Profile: true,
})
c.Assert(err, test.IsNil)
err = res.One(&response)
c.Assert(err, test.IsNil)
c.Assert(res.Profile(), test.NotNil)
c.Assert(response, test.Equals, "Test")
}
func (s *RethinkSuite) TestQueryRunRawTime(c *test.C) {
var response map[string]interface{}
res, err := Now().Run(session, RunOpts{
TimeFormat: "raw",
})
c.Assert(err, test.IsNil)
err = res.One(&response)
c.Assert(err, test.IsNil)
c.Assert(response["$reql_type$"], test.NotNil)
c.Assert(response["$reql_type$"], test.Equals, "TIME")
}