Debian Codegraph @

session.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 "crypto/tlsscip-go gomod github.com/golang/go/src go1.14 `crypto/tls`/"
5 "syncscip-go gomod github.com/golang/go/src go1.14 sync/"
6 "timescip-go gomod github.com/golang/go/src go1.14 time/"
7
8 "golang.org/x/net/contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/"
9 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`/"
10 )
11
12 // A Session represents a connection to a RethinkDB cluster and should be used
13 // when executing queries.
14 type Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session# struct {
15 hostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#hosts. []Hostscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Host#
16 optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts. *ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#
17
18 muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu. syncscip-go gomod github.com/golang/go/src go1.14 sync/.RWMutexscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#
19 clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster. *Clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#
20 closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. bool
21 }
22
23 // ConnectOpts is used to specify optional arguments when connecting to a cluster.
24 type ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts# struct {
25 // Address holds the address of the server initially used when creating the
26 // session. Only used if Addresses is empty
27 Addressscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Address. string `rethinkdb:"address,omitempty" json:"address,omitempty"`
28 // Addresses holds the addresses of the servers initially used when creating
29 // the session.
30 Addressesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Addresses. []string `rethinkdb:"addresses,omitempty" json:"addresses,omitempty"`
31 // Database is the default database name used when executing queries, this
32 // value is only used if the query does not contain any DB term
33 Databasescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Database. string `rethinkdb:"database,omitempty" json:"database,omitempty"`
34 // Username holds the username used for authentication, if blank (and the v1
35 // handshake protocol is being used) then the admin user is used
36 Usernamescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Username. string `rethinkdb:"username,omitempty" json:"username,omitempty"`
37 // Password holds the password used for authentication (only used when using
38 // the v1 handshake protocol)
39 Passwordscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Password. string `rethinkdb:"password,omitempty" json:"password,omitempty"`
40 // AuthKey is used for authentication when using the v0.4 handshake protocol
41 // This field is no deprecated
42 AuthKeyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#AuthKey. string `rethinkdb:"authkey,omitempty" json:"authkey,omitempty"`
43 // Timeout is the time the driver waits when creating new connections, to
44 // configure the timeout used when executing queries use WriteTimeout and
45 // ReadTimeout
46 Timeoutscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Timeout. timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration# `rethinkdb:"timeout,omitempty" json:"timeout,omitempty"`
47 // WriteTimeout is the amount of time the driver will wait when sending the
48 // query to the server
49 // Deprecated: use RunOpts.Context instead
50 WriteTimeoutscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#WriteTimeout. timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration# `rethinkdb:"write_timeout,omitempty" json:"write_timeout,omitempty"`
51 // ReadTimeout is the amount of time the driver will wait for a response from
52 // the server when executing queries.
53 // Deprecated: use RunOpts.Context instead
54 ReadTimeoutscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#ReadTimeout. timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration# `rethinkdb:"read_timeout,omitempty" json:"read_timeout,omitempty"`
55 // KeepAlivePeriod is the keep alive period used by the connection, by default
56 // this is 30s. It is not possible to disable keep alive messages
57 KeepAlivePeriodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#KeepAlivePeriod. timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration# `rethinkdb:"keep_alive_timeout,omitempty" json:"keep_alive_timeout,omitempty"`
58 // TLSConfig holds the TLS configuration and can be used when connecting
59 // to a RethinkDB server protected by SSL
60 TLSConfigscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#TLSConfig. *tlsscip-go gomod github.com/golang/go/src go1.14 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.14 `crypto/tls`/Config# `rethinkdb:"tlsconfig,omitempty" json:"tlsconfig,omitempty"`
61 // HandshakeVersion is used to specify which handshake version should be
62 // used, this currently defaults to v1 which is used by RethinkDB 2.3 and
63 // later. If you are using an older version then you can set the handshake
64 // version to 0.4
65 HandshakeVersionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#HandshakeVersion. HandshakeVersionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeVersion# `rethinkdb:"handshake_version,omitempty" json:"handshake_version,omitempty"`
66 // UseJSONNumber indicates whether the cursors running in this session should
67 // use json.Number instead of float64 while unmarshaling documents with
68 // interface{}. The default is `false`.
69 UseJSONNumberscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#UseJSONNumber. bool `json:"use_json_number,omitempty"`
70 // NumRetries is the number of times a query is retried if a connection
71 // error is detected, queries are not retried if RethinkDB returns a
72 // runtime error.
73 // Default is 3.
74 NumRetriesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#NumRetries. int `json:"num_retries,omitempty"`
75
76 // InitialCap is used by the internal connection pool and is used to
77 // configure how many connections are created for each host when the
78 // session is created. If zero then no connections are created until
79 // the first query is executed.
80 InitialCapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#InitialCap. int `rethinkdb:"initial_cap,omitempty" json:"initial_cap,omitempty"`
81 // MaxOpen is used by the internal connection pool and is used to configure
82 // the maximum number of connections held in the pool. By default the
83 // maximum number of connections is 1
84 MaxOpenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#MaxOpen. int `rethinkdb:"max_open,omitempty" json:"max_open,omitempty"`
85
86 // Below options are for cluster discovery, please note there is a high
87 // probability of these changing as the API is still being worked on.
88
89 // DiscoverHosts is used to enable host discovery, when true the driver
90 // will attempt to discover any new nodes added to the cluster and then
91 // start sending queries to these new nodes.
92 DiscoverHostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#DiscoverHosts. bool `rethinkdb:"discover_hosts,omitempty" json:"discover_hosts,omitempty"`
93 // HostDecayDuration is used by the go-hostpool package to calculate a weighted
94 // score when selecting a host. By default a value of 5 minutes is used.
95 HostDecayDurationscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#HostDecayDuration. timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration# `json:"host_decay_duration,omitempty"`
96
97 // UseOpentracing is used to enable creating opentracing-go spans for queries.
98 // Each span is created as child of span from the context in `RunOpts`.
99 // This span lasts from point the query created to the point when cursor closed.
100 UseOpentracingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#UseOpentracing. bool `json:"use_opentracing,omitempty"`
101
102 // Deprecated: This function is no longer used due to changes in the
103 // way hosts are selected.
104 NodeRefreshIntervalscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#NodeRefreshInterval. timescip-go gomod github.com/golang/go/src go1.14 time/.Durationscip-go gomod github.com/golang/go/src go1.14 time/Duration# `rethinkdb:"node_refresh_interval,omitempty" json:"node_refresh_interval,omitempty"`
105 // Deprecated: Use InitialCap instead
106 MaxIdlescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#MaxIdle. int `rethinkdb:"max_idle,omitempty" json:"max_idle,omitempty"`
107 }
108
109 func (o ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#) toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#toMap().() map[string]interface{} {
110 return optArgsToMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/optArgsToMap().(o)
111 }
112
113 // Connect creates a new database session. To view the available connection
114 // options see ConnectOpts.
115 //
116 // By default maxIdle and maxOpen are set to 1: passing values greater
117 // than the default (e.g. MaxIdle: "10", MaxOpen: "20") will provide a
118 // pool of re-usable connections.
119 //
120 // Basic connection example:
121 //
122 // session, err := r.Connect(r.ConnectOpts{
123 // Address: "localhost:28015",
124 // Database: "test",
125 // AuthKey: "14daak1cad13dj",
126 // })
127 //
128 // Cluster connection example:
129 //
130 // session, err := r.Connect(r.ConnectOpts{
131 // Addresses: []string{"localhost:28015", "localhost:28016"},
132 // Database: "test",
133 // AuthKey: "14daak1cad13dj",
134 // })
135 func Connectscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connect().(opts ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#) (*Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#, error) {
136 var addresses = opts.Addressesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Addresses.
137 if len(addresses) == 0 {
138 addresses = []string{opts.Addressscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Address.}
139 }
140
141 hosts := make([]Hostscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Host#, len(addresses))
142 for i, address := range addresses {
143 hostname, port := splitAddressscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/splitAddress().(address)
144 hosts[i] = NewHostscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/NewHost().(hostname, port)
145 }
146 if len(hosts) <= 0 {
147 return nil, ErrNoHostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrNoHosts.
148 }
149
150 // Connect
151 s := &Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#{
152 hostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#hosts.: hosts,
153 optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts.: &opts,
154 }
155
156 err := s.Reconnectscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Reconnect().()
157 if err != nil {
158 // note: s.Reconnect() will initialize cluster information which
159 // will cause the .IsConnected() method to be caught in a loop
160 return &Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#{
161 hostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#hosts.: hosts,
162 optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts.: &opts,
163 }, err
164 }
165
166 return s, nil
167 }
168
169 // CloseOpts allows calls to the Close function to be configured.
170 type CloseOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts# struct {
171 NoReplyWaitscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts#NoReplyWait. bool `rethinkdb:"noreplyWait,omitempty"`
172 }
173
174 func (o CloseOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts#) toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts#toMap().() map[string]interface{} {
175 return optArgsToMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/optArgsToMap().(o)
176 }
177
178 // IsConnected returns true if session has a valid connection.
179 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) IsConnectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#IsConnected().() bool {
180 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RLockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RLock().()
181 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RUnlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RUnlock().()
182
183 if s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster. == nil || s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. {
184 return false
185 }
186 return s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..IsConnectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#IsConnected().()
187 }
188
189 // Reconnect closes and re-opens a session.
190 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Reconnectscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Reconnect().(optArgs ...CloseOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts#) error {
191 var err error
192
193 if err = s.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Close().(optArgs...); err != nil {
194 return err
195 }
196
197 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
198 s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster., err = NewClusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/NewCluster().(s.hostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#hosts., s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts.)
199 if err != nil {
200 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
201 return err
202 }
203
204 s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. = false
205 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
206
207 return nil
208 }
209
210 // Close closes the session
211 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Close().(optArgs ...CloseOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts#) error {
212 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
213 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
214
215 if s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. {
216 return nil
217 }
218
219 if len(optArgs) >= 1 {
220 if optArgs[0].NoReplyWaitscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/CloseOpts#NoReplyWait. {
221 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
222 s.NoReplyWaitscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#NoReplyWait().()
223 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
224 }
225 }
226
227 if s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster. != nil {
228 return s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#Close().()
229 }
230 s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster. = nil
231 s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. = true
232
233 return nil
234 }
235
236 // SetInitialPoolCap sets the initial capacity of the connection pool.
237 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) SetInitialPoolCapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#SetInitialPoolCap().(n int) {
238 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
239 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
240
241 s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts..InitialCapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#InitialCap. = n
242 s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..SetInitialPoolCapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#SetInitialPoolCap().(n)
243 }
244
245 // SetMaxIdleConns sets the maximum number of connections in the idle
246 // connection pool.
247 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) SetMaxIdleConnsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#SetMaxIdleConns().(n int) {
248 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
249 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
250
251 s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts..MaxIdlescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#MaxIdle. = n
252 s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..SetMaxIdleConnsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#SetMaxIdleConns().(n)
253 }
254
255 // SetMaxOpenConns sets the maximum number of open connections to the database.
256 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) SetMaxOpenConnsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#SetMaxOpenConns().(n int) {
257 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
258 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
259
260 s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts..MaxOpenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#MaxOpen. = n
261 s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..SetMaxOpenConnsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#SetMaxOpenConns().(n)
262 }
263
264 // NoReplyWait ensures that previous queries with the noreply flag have been
265 // processed by the server. Note that this guarantee only applies to queries
266 // run on the given connection
267 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) NoReplyWaitscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#NoReplyWait().() error {
268 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RLockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RLock().()
269 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RUnlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RUnlock().()
270
271 if s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. {
272 return ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed.
273 }
274
275 return s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#Exec().(nil, Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#{ // nil = connection opts' defaults
276 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_NOREPLY_WAITscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_NOREPLY_WAIT.,
277 })
278 }
279
280 // Use changes the default database used
281 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Usescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Use().(database string) {
282 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
283 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
284
285 s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts..Databasescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Database. = database
286 }
287
288 // Database returns the selected database set by Use
289 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Databasescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Database().() string {
290 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RLockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RLock().()
291 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RUnlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RUnlock().()
292
293 return s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts..Databasescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Database.
294 }
295
296 // Query executes a ReQL query using the session to connect to the database
297 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#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) {
298 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RLockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RLock().()
299 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RUnlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RUnlock().()
300
301 if s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. {
302 return nil, ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed.
303 }
304
305 return s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#Query().(ctx, q)
306 }
307
308 // Exec executes a ReQL query using the session to connect to the database
309 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#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 {
310 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RLockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RLock().()
311 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..RUnlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#RUnlock().()
312
313 if s.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#closed. {
314 return ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed.
315 }
316
317 return s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#Exec().(ctx, q)
318 }
319
320 // Server returns the server name and server UUID being used by a connection.
321 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) Serverscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#Server().() (ServerResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ServerResponse#, error) {
322 return s.clusterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#cluster..Serverscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cluster#Server().()
323 }
324
325 // SetHosts resets the hosts used when connecting to the RethinkDB cluster
326 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) SetHostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#SetHosts().(hosts []Hostscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Host#) {
327 s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Lock().()
328 defer s.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/RWMutex#Unlock().()
329
330 s.hostsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#hosts. = hosts
331 }
332
333 func (s *Sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#) newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#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) {
334 return newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newQuery().(t, opts, s.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Session#opts.)
335 }