Debian Codegraph @

mock.go

raw symbols SCIP
1 package rethinkdbscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/
2
3 import (
4 "encoding/binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/"
5 "encoding/jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/"
6 "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/"
7 "gopkg.in/rethinkdb/rethinkdb-go.v6/encodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/"
8 "netscip-go gomod github.com/golang/go/src go1.14 net/"
9 "reflectscip-go gomod github.com/golang/go/src go1.14 reflect/"
10 "syncscip-go gomod github.com/golang/go/src go1.14 sync/"
11 "timescip-go gomod github.com/golang/go/src go1.14 time/"
12
13 "golang.org/x/net/contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/"
14 pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/ "gopkg.in/rethinkdb/rethinkdb-go.v6/ql2scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/"
15 )
16
17 // Mocking is based on the amazing package github.com/stretchr/testify
18
19 // testingT is an interface wrapper around *testing.T
20 type testingTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT# interface {
21 Logfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Logf.(format string, args ...interface{})
22 Errorfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Errorf.(format string, args ...interface{})
23 FailNowscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#FailNow.()
24 }
25
26 // MockAnything can be used in place of any term, this is useful when you want
27 // mock similar queries or queries that you don't quite know the exact structure
28 // of.
29 func MockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockAnything().() Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# {
30 t := constructRootTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/constructRootTerm().("MockAnything", pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_DATUMscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_DATUM., nil, nil)
31 t.isMockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#isMockAnything. = true
32
33 return t
34 }
35
36 func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) MockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#MockAnything().() Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# {
37 t = constructMethodTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/constructMethodTerm().(t, "MockAnything", pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_DATUMscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_DATUM., nil, nil)
38 t.isMockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#isMockAnything. = true
39
40 return t
41 }
42
43 // MockQuery represents a mocked query and is used for setting expectations,
44 // as well as recording activity.
45 type MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# struct {
46 parentscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#parent. *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#
47
48 // Holds the query and term
49 Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query. Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#
50
51 // Holds the JSON representation of query
52 BuiltQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#BuiltQuery. []byte
53
54 // Holds the response that should be returned when this method is executed.
55 Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Response. interface{}
56
57 // Holds the error that should be returned when this method is executed.
58 Errorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Error. error
59
60 // The number of times to return the return arguments when setting
61 // expectations. 0 means to always return the value.
62 Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. int
63
64 // Holds a channel that will be used to block the Return until it either
65 // recieves a message or is connClosed. nil means it returns immediately.
66 WaitForscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitFor. <-chan timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time#
67
68 // Amount of times this query has been executed
69 executedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#executed. int
70 }
71
72 func newMockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockQuery().(parent *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
73 // Build and marshal term
74 builtQuery, err := jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Marshal().(q.Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Build().())
75 if err != nil {
76 panic(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Failed to build query: %s", err))
77 }
78
79 return &MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#{
80 parentscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#parent.: parent,
81 Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query.: q,
82 BuiltQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#BuiltQuery.: builtQuery,
83 Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Response.: make([]interface{}, 0),
84 Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability.: 0,
85 WaitForscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitFor.: nil,
86 }
87 }
88
89 func newMockQueryFromTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockQueryFromTerm().(parent *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#, t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#, opts map[string]interface{}) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
90 q, err := parent.newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#newQuery().(t, opts)
91 if err != nil {
92 panic(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Failed to build query: %s", err))
93 }
94
95 return newMockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockQuery().(parent, q)
96 }
97
98 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) lockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#lock().() {
99 mq.parentscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#parent..muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
100 }
101
102 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) unlockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#unlock().() {
103 mq.parentscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#parent..muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
104 }
105
106 // Return specifies the return arguments for the expectation.
107 //
108 // mock.On(r.Table("test")).Return(nil, errors.New("failed"))
109 //
110 // values of `chan []interface{}` type will turn to delayed data that produce data
111 // when there is an elements available on the channel. These elements are chunk of responses.
112 // Values of `func() []interface{}` type will produce data by calling the function. E.g.
113 // Closing channel or returning nil from func means end of data.
114 //
115 // f := func() []interface{} { return []interface{}{1, 2} }
116 // mock.On(r.Table("test1")).Return(f)
117 //
118 // ch := make(chan []interface{})
119 // mock.On(r.Table("test1")).Return(ch)
120 //
121 // Running the query above will block until a value is pushed onto ch.
122 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) Returnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Return().(response interface{}, err error) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
123 mq.lockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#lock().()
124 defer mq.unlockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#unlock().()
125
126 mq.Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Response. = response
127 mq.Errorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Error. = err
128
129 return mq
130 }
131
132 // Once indicates that that the mock should only return the value once.
133 //
134 // mock.On(r.Table("test")).Return(result, nil).Once()
135 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) Oncescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Once().() *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
136 return mq.Timesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Times().(1)
137 }
138
139 // Twice indicates that that the mock should only return the value twice.
140 //
141 // mock.On(r.Table("test")).Return(result, nil).Twice()
142 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) Twicescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Twice().() *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
143 return mq.Timesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Times().(2)
144 }
145
146 // Times indicates that that the mock should only return the indicated number
147 // of times.
148 //
149 // mock.On(r.Table("test")).Return(result, nil).Times(5)
150 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) Timesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Times().(i int) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
151 mq.lockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#lock().()
152 defer mq.unlockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#unlock().()
153 mq.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. = i
154 return mq
155 }
156
157 // WaitUntil sets the channel that will block the mock's return until its connClosed
158 // or a message is received.
159 //
160 // mock.On(r.Table("test")).WaitUntil(time.After(time.Second))
161 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) WaitUntilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitUntil().(w <-chan timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time#) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
162 mq.lockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#lock().()
163 defer mq.unlockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#unlock().()
164 mq.WaitForscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitFor. = w
165 return mq
166 }
167
168 // After sets how long to block until the query returns
169 //
170 // mock.On(r.Table("test")).After(time.Second)
171 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) Afterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#After().(d timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration#) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
172 return mq.WaitUntilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitUntil().(timescip-go gomod github.com/golang/go/src go1.14 time/.Afterscip-go gomod github.com/golang/go/src go1.14 time/After().(d))
173 }
174
175 // On chains a new expectation description onto the mocked interface. This
176 // allows syntax like.
177 //
178 // Mock.
179 // On(r.Table("test")).Return(result, nil).
180 // On(r.Table("test2")).Return(nil, errors.New("Some Error"))
181 func (mq *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) Onscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#On().(t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
182 return mq.parentscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#parent..Onscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#On().(t)
183 }
184
185 // Mock is used to mock query execution and verify that the expected queries are
186 // being executed. Mocks are used by creating an instance using NewMock and then
187 // passing this when running your queries instead of a session. For example:
188 //
189 // mock := r.NewMock()
190 // mock.On(r.Table("test")).Return([]interface{}{data}, nil)
191 //
192 // cursor, err := r.Table("test").Run(mock)
193 //
194 // mock.AssertExpectations(t)
195 type Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock# struct {
196 muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu. syncscip-go gomod github.com/golang/go/src go1.14 sync/.Mutexscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#
197 optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#opts. ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#
198
199 ExpectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#ExpectedQueries. []*MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#
200 Queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Queries. []MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#
201 }
202
203 // NewMock creates an instance of Mock, you can optionally pass ConnectOpts to
204 // the function, if passed any mocked query will be generated using those
205 // options.
206 func NewMockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/NewMock().(opts ...ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#) *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock# {
207 m := &Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#{
208 ExpectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#ExpectedQueries.: make([]*MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#, 0),
209 Queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Queries.: make([]MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#, 0),
210 }
211
212 if len(opts) > 0 {
213 m.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#opts. = opts[0]
214 }
215
216 return m
217 }
218
219 // On starts a description of an expectation of the specified query
220 // being executed.
221 //
222 // mock.On(r.Table("test"))
223 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) Onscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#On().(t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#, opts ...map[string]interface{}) *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
224 var qopts map[string]interface{}
225 if len(opts) > 0 {
226 qopts = opts[0]
227 }
228
229 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
230 defer m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
231 mq := newMockQueryFromTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockQueryFromTerm().(m, t, qopts)
232 m.ExpectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#ExpectedQueries. = append(m.ExpectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#ExpectedQueries., mq)
233 return mq
234 }
235
236 // AssertExpectations asserts that everything specified with On and Return was
237 // in fact executed as expected. Queries may have been executed in any order.
238 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) AssertExpectationsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#AssertExpectations().(t testingTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#) bool {
239 var somethingMissing bool
240 var failedExpectations int
241
242 // iterate through each expectation
243 expectedQueries := m.expectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#expectedQueries().()
244 for _, expectedQuery := range expectedQueries {
245 if !m.queryWasExecutedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queryWasExecuted().(expectedQuery) && expectedQuery.executedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#executed. == 0 {
246 somethingMissing = true
247 failedExpectations++
248 t.Logfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Logf.("❌\t%s", expectedQuery.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().())
249 } else {
250 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
251 if expectedQuery.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. > 0 {
252 somethingMissing = true
253 failedExpectations++
254 } else {
255 t.Logfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Logf.("✅\t%s", expectedQuery.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().())
256 }
257 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
258 }
259 }
260
261 if somethingMissing {
262 t.Errorfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Errorf.("FAIL: %d out of %d expectation(s) were met.\n\tThe query you are testing needs to be executed %d more times(s).", len(expectedQueries)-failedExpectations, len(expectedQueries), failedExpectations)
263 }
264
265 return !somethingMissing
266 }
267
268 // AssertNumberOfExecutions asserts that the query was executed expectedExecutions times.
269 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) AssertNumberOfExecutionsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#AssertNumberOfExecutions().(t testingTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#, expectedQuery *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#, expectedExecutions int) bool {
270 var actualExecutions int
271 for _, query := range m.queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queries().() {
272 if query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..comparescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#compare().(*expectedQuery.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., map[int64]int64{}) && query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. > -1 {
273 // if bytes.Equal(query.BuiltQuery, expectedQuery.BuiltQuery) {
274 actualExecutions++
275 }
276 }
277
278 if expectedExecutions != actualExecutions {
279 t.Errorfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Errorf.("Expected number of executions (%d) does not match the actual number of executions (%d).", expectedExecutions, actualExecutions)
280 return false
281 }
282
283 return true
284 }
285
286 // AssertExecuted asserts that the method was executed.
287 // It can produce a false result when an argument is a pointer type and the underlying value changed after executing the mocked method.
288 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) AssertExecutedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#AssertExecuted().(t testingTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#, expectedQuery *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) bool {
289 if !m.queryWasExecutedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queryWasExecuted().(expectedQuery) {
290 t.Errorfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Errorf.("The query \"%s\" should have been executed, but was not.", expectedQuery.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().())
291 return false
292 }
293 return true
294 }
295
296 // AssertNotExecuted asserts that the method was not executed.
297 // It can produce a false result when an argument is a pointer type and the underlying value changed after executing the mocked method.
298 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) AssertNotExecutedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#AssertNotExecuted().(t testingTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#, expectedQuery *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) bool {
299 if m.queryWasExecutedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queryWasExecuted().(expectedQuery) {
300 t.Errorfscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/testingT#Errorf.("The query \"%s\" was executed, but should NOT have been.", expectedQuery.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().())
301 return false
302 }
303 return true
304 }
305
306 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) IsConnectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#IsConnected().() bool {
307 return true
308 }
309
310 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Query().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) (*Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) {
311 found, query := m.findExpectedQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#findExpectedQuery().(q)
312
313 if found < 0 {
314 panic(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("rethinkdb: mock: This query was unexpected:\n\t\t%s", q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().()))
315 } else {
316 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
317 switch {
318 case query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. == 1:
319 query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. = -1
320 query.executedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#executed.++
321
322 case query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. > 1:
323 query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability.--
324 query.executedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#executed.++
325
326 case query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. == 0:
327 query.executedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#executed.++
328 }
329 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
330 }
331
332 // add the query
333 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
334 m.Queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Queries. = append(m.Queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Queries., *newMockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockQuery().(m, q))
335 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
336
337 // block if specified
338 if query.WaitForscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitFor. != nil {
339 <-query.WaitForscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#WaitFor.
340 }
341
342 // Return error without building cursor if non-nil
343 if query.Errorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Error. != nil {
344 return nil, query.Errorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Error.
345 }
346
347 if ctx == nil {
348 ctx = contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Backgroundscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Background().()
349 }
350
351 conn := newConnectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newConnection().(newMockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockConn().(query.Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Response.), "mock", &ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#{})
352
353 query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. = pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_CONTINUEscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_CONTINUE.
354 query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token. = conn.nextTokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#nextToken().()
355
356 // Build cursor and return
357 c := newCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newCursor().(ctx, conn, "", query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token., query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.)
358 c.finishedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#finished. = true
359 c.fetchingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#fetching. = false
360 c.isAtomscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#isAtom. = true
361 c.finishedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#finished. = false
362 c.releaseConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#releaseConn. = func() error { return conn.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().() }
363
364 conn.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors.[query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token.] = c
365 go conn.readSocketscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readSocket().()
366 go conn.processResponsesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processResponses().()
367
368 c.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
369 err := c.fetchMorescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#fetchMore().()
370 c.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
371 if err != nil {
372 return nil, err
373 }
374
375 return c, nil
376 }
377
378 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Exec().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) error {
379 _, err := m.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Query().(ctx, q)
380
381 return err
382 }
383
384 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#newQuery().(t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#, opts map[string]interface{}) (Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#, error) {
385 return newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newQuery().(t, opts, &m.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#opts.)
386 }
387
388 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) findExpectedQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#findExpectedQuery().(q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) (int, *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) {
389 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
390 defer m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
391
392 for i, query := range m.ExpectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#ExpectedQueries. {
393 // if bytes.Equal(query.BuiltQuery, builtQuery) && query.Repeatability > -1 {
394 if query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..comparescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#compare().(*q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., map[int64]int64{}) && query.Repeatabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Repeatability. > -1 {
395 return i, query
396 }
397 }
398
399 return -1, nil
400 }
401
402 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) queryWasExecutedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queryWasExecuted().(expectedQuery *MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#) bool {
403 for _, query := range m.queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queries().() {
404 if query.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..comparescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#compare().(*expectedQuery.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#Query..Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., map[int64]int64{}) {
405 // if bytes.Equal(query.BuiltQuery, expectedQuery.BuiltQuery) {
406 return true
407 }
408 }
409
410 // we didn't find the expected query
411 return false
412 }
413
414 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) expectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#expectedQueries().() []*MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
415 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
416 defer m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
417 return append([]*MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#{}, m.ExpectedQueriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#ExpectedQueries....)
418 }
419
420 func (m *Mockscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#) queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#queries().() []MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery# {
421 m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
422 defer m.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
423 return append([]MockQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/MockQuery#{}, m.Queriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Mock#Queries....)
424 }
425
426 type mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn# struct {
427 muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#mu. syncscip-go gomod github.com/golang/go/src go1.14 sync/.Mutexscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#
428 valuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#value. []byte
429 tokensscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#tokens. chan int64
430 valueGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#valueGetter. func() []interface{}
431 }
432
433 func newMockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newMockConn().(response interface{}) *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn# {
434 c := &mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#{tokensscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#tokens.: make(chan int64, 1)}
435 switch g := response.(type) {
436 case chan []interface{}:
437 c.valueGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#valueGetter. = func() []interface{} { return <-g }
438 case func() []interface{}:
439 c.valueGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#valueGetter. = g
440 default:
441 responseVal := reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.14 reflect/ValueOf().(response)
442 if responseVal.Kindscip-go gomod github.com/golang/go/src go1.14 reflect/Value#Kind().() == reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.Slicescip-go gomod github.com/golang/go/src go1.14 reflect/Slice. || responseVal.Kindscip-go gomod github.com/golang/go/src go1.14 reflect/Value#Kind().() == reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.Arrayscip-go gomod github.com/golang/go/src go1.14 reflect/Array. {
443 responses := make([]interface{}, responseVal.Lenscip-go gomod github.com/golang/go/src go1.14 reflect/Value#Len().())
444 for i := 0; i < responseVal.Lenscip-go gomod github.com/golang/go/src go1.14 reflect/Value#Len().(); i++ {
445 responses[i] = responseVal.Indexscip-go gomod github.com/golang/go/src go1.14 reflect/Value#Index().(i).Interfacescip-go gomod github.com/golang/go/src go1.14 reflect/Value#Interface().()
446 }
447 c.valueGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#valueGetter. = funcGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/funcGetter().(responses)
448 } else {
449 c.valueGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#valueGetter. = funcGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/funcGetter().([]interface{}{response})
450 }
451 }
452 return c
453 }
454
455 func funcGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/funcGetter().(responses []interface{}) func() []interface{} {
456 done := false
457 return func() []interface{} {
458 if done {
459 return nil
460 }
461 done = true
462 return responses
463 }
464 }
465
466 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) Readscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#Read().(b []byte) (n int, err error) {
467 c.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().()
468 defer c.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().()
469
470 if c.valuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#value. == nil {
471 values := c.valueGetterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#valueGetter.()
472
473 jresps := make([]jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.RawMessagescip-go gomod github.com/golang/go/src go1.14 `encoding/json`/RawMessage#, len(values))
474 for i := range values {
475 coded, err := encodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/.Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(values[i])
476 if err != nil {
477 panic(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("failed to encode response: %v", err))
478 }
479 jresps[i], err = jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Marshal().(coded)
480 if err != nil {
481 panic(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("failed to encode response: %v", err))
482 }
483 }
484
485 token := <-c.tokensscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#tokens.
486 resp := Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#{
487 Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.: token,
488 Responsesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Responses.: jresps,
489 Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Type.: pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SUCCESS_PARTIALscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SUCCESS_PARTIAL.,
490 }
491 if values == nil {
492 resp.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Type. = pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SUCCESS_SEQUENCEscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SUCCESS_SEQUENCE.
493 }
494
495 c.valuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#value., err = jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Marshal().(resp)
496 if err != nil {
497 panic(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("failed to encode response: %v", err))
498 }
499
500 if len(b) != respHeaderLenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/respHeaderLen. {
501 panic("wrong header len")
502 }
503 binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint64scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint64().(b[:8], uint64(token))
504 binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint32().(b[8:], uint32(len(c.valuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#value.)))
505 return len(b), nil
506 } else {
507 copy(b, c.valuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#value.)
508 c.valuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#value. = nil
509 return len(b), nil
510 }
511 }
512
513 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) Writescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#Write().(b []byte) (n int, err error) {
514 if len(b) < 8 {
515 panic("connBad socket write")
516 }
517 token := int64(binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..Uint64scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#Uint64().(b[:8]))
518 c.tokensscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#tokens. <- token
519 return len(b), nil
520 }
521 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#Close().() error { return nil }
522 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) LocalAddrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#LocalAddr().() netscip-go gomod github.com/golang/go/src go1.14 net/.Addrscip-go gomod github.com/golang/go/src go1.14 net/Addr# { panic("not implemented") }
523 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) RemoteAddrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#RemoteAddr().() netscip-go gomod github.com/golang/go/src go1.14 net/.Addrscip-go gomod github.com/golang/go/src go1.14 net/Addr# { panic("not implemented") }
524 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) SetDeadlinescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#SetDeadline().(t timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time#) error { panic("not implemented") }
525 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) SetReadDeadlinescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#SetReadDeadline().(t timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time#) error { panic("not implemented") }
526 func (c *mockConnscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#) SetWriteDeadlinescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/mockConn#SetWriteDeadline().(t timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time#) error { panic("not implemented") }