File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ func Example_Get() {
1919 Address : url ,
2020 AuthKey : authKey ,
2121 })
22+ if err != nil {
23+ log .Fatalf ("Error connecting to DB: %s" , err )
24+ }
2225
2326 // Setup table
2427 r .Db ("test" ).TableDrop ("table" ).Run (sess )
@@ -59,6 +62,9 @@ func Example_GetAll_Compound() {
5962 Address : url ,
6063 AuthKey : authKey ,
6164 })
65+ if err != nil {
66+ log .Fatalf ("Error connecting to DB: %s" , err )
67+ }
6268
6369 // Setup table
6470 r .Db ("test" ).TableDrop ("table" ).Run (sess )
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ func Example_TableCreate() {
1212 Address : url ,
1313 AuthKey : authKey ,
1414 })
15+ if err != nil {
16+ log .Fatalf ("Error connecting to DB: %s" , err )
17+ }
1518
1619 // Setup database
1720 r .Db ("test" ).TableDrop ("table" ).Run (sess )
@@ -32,6 +35,9 @@ func Example_IndexCreate() {
3235 Address : url ,
3336 AuthKey : authKey ,
3437 })
38+ if err != nil {
39+ log .Fatalf ("Error connecting to DB: %s" , err )
40+ }
3541
3642 // Setup database
3743 r .Db ("test" ).TableDrop ("table" ).Run (sess )
@@ -53,6 +59,9 @@ func Example_IndexCreate_compound() {
5359 Address : url ,
5460 AuthKey : authKey ,
5561 })
62+ if err != nil {
63+ log .Fatalf ("Error connecting to DB: %s" , err )
64+ }
5665
5766 // Setup database
5867 r .Db ("test" ).TableDrop ("table" ).Run (sess )
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ func Example() {
2828 AuthKey : authKey ,
2929 })
3030 if err != nil {
31- log .Fatalln ( err . Error () )
31+ log .Fatalf ( " Error connecting to DB: %s" , err )
3232 }
3333
3434 res , err := r .Expr ("Hello World" ).Run (session )
Original file line number Diff line number Diff line change @@ -347,13 +347,17 @@ func (s *Session) noreplyWaitQuery() error {
347347
348348 return nil
349349}
350- func (s * Session ) getConn () (Connection , error ) {
350+ func (s * Session ) getConn () (* Connection , error ) {
351+ if s .pool == nil {
352+ return nil , pool .ErrClosed
353+ }
354+
351355 c , err := s .pool .Get ()
352356 if err != nil {
353- return Connection {} , err
357+ return nil , err
354358 }
355359
356- return Connection {Conn : c , s : s }, nil
360+ return & Connection {Conn : c , s : s }, nil
357361}
358362
359363func (s * Session ) checkCache (token int64 ) (* Cursor , bool ) {
You can’t perform that action at this time.
0 commit comments