forked from rethinkdb/rethinkdb-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_connect_test.go
More file actions
55 lines (45 loc) · 863 Bytes
/
Copy pathexample_connect_test.go
File metadata and controls
55 lines (45 loc) · 863 Bytes
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
51
52
53
54
55
package gorethink_test
import (
"log"
"os"
r "gopkg.in/gorethink/gorethink.v3"
)
var session *r.Session
var url string
func init() {
// If the test is being run by wercker look for the rethink url
url = os.Getenv("RETHINKDB_URL")
if url == "" {
url = "localhost:28015"
}
}
func ExampleConnect() {
var err error
session, err = r.Connect(r.ConnectOpts{
Address: url,
})
if err != nil {
log.Fatalln(err.Error())
}
}
func ExampleConnect_connectionPool() {
var err error
session, err = r.Connect(r.ConnectOpts{
Address: url,
InitialCap: 10,
MaxOpen: 10,
})
if err != nil {
log.Fatalln(err.Error())
}
}
func ExampleConnect_cluster() {
var err error
session, err = r.Connect(r.ConnectOpts{
Addresses: []string{url},
// Addresses: []string{url1, url2, url3, ...},
})
if err != nil {
log.Fatalln(err.Error())
}
}