Skip to content

Commit 362e177

Browse files
committed
Updated examples in README
1 parent 4603cc1 commit 362e177

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ import (
3232

3333
var session *r.Session
3434

35-
session, err := r.Connect(map[string]interface{}{
36-
"address": "localhost:28015",
37-
"database": "test",
38-
"authkey": "14daak1cad13dj",
39-
})
40-
41-
if err != nil {
42-
log.Fatalln(err.Error())
43-
}
35+
session, err := r.Connect(r.ConnectOpts{
36+
Address: "localhost:28015",
37+
Database: "test",
38+
})
39+
40+
if err != nil {
41+
log.Fatalln(err.Error())
42+
}
4443

4544
```
4645
See the [documentation](http://godoc.org/github.com/dancannon/gorethink#Connect) for a list of supported arguments to Connect().
@@ -56,16 +55,16 @@ import (
5655

5756
var session *r.Session
5857

59-
session, err := r.Connect(map[string]interface{}{
60-
"address": "localhost:28015",
61-
"database": "test",
62-
"maxIdle": 10,
63-
"idleTimeout": time.Second * 10,
64-
})
58+
session, err := r.Connect(r.ConnectOpts{
59+
Address: "localhost:28015",
60+
Database: "test",
61+
MaxIdle: 10,
62+
IdleTimeout: time.Second * 10,
63+
})
6564

66-
if err != nil {
67-
log.Fatalln(err.Error())
68-
}
65+
if err != nil {
66+
log.Fatalln(err.Error())
67+
}
6968
```
7069

7170
A pre-configured [Pool](http://godoc.org/github.com/dancannon/gorethink#Pool) instance can also be passed to Connect().

session.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ func (o *ConnectOpts) toMap() map[string]interface{} {
9292
// Basic connection example:
9393
//
9494
// var session *r.Session
95-
// session, err := r.Connect(r.ConncetOpts{
96-
// Address: "localhost:28015",
97-
// Database: "test",
98-
// AuthKey: "14daak1cad13dj",
99-
// })
95+
// session, err := r.Connect(r.ConnectOpts{
96+
// Address: "localhost:28015",
97+
// Database: "test",
98+
// AuthKey: "14daak1cad13dj",
99+
// })
100100
func Connect(args ConnectOpts) (*Session, error) {
101101
s := newSession(args.toMap())
102102
err := s.Reconnect()

0 commit comments

Comments
 (0)