Skip to content

Commit 27c275d

Browse files
committed
Merge branch 'hotfix/v1.1.3'
2 parents c52349e + d2ede07 commit 27c275d

File tree

8 files changed

+38
-11
lines changed

8 files changed

+38
-11
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ before_script:
1616
- rethinkdb --port-offset 2 --directory rethinkdb_data2 --join localhost:29016 > /dev/null 2>&1 &
1717
- rethinkdb --port-offset 3 --directory rethinkdb_data3 --join localhost:29016 > /dev/null 2>&1 &
1818

19-
script: go test -tags='cluster' -race -check.vv -v ./...
19+
script: go test -tags='cluster' -short -race -check.vv -v ./...

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## v1.1.3
6+
### Fixed
7+
- Fixed pointers not to be properly decoded
8+
- Fixed queries always timing out when Timeout ConnectOpt is set.
9+
510
## v1.1.2
611
### Fixed
712
- Fixed issue when encoding some maps

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
![GoRethink Logo](https://raw.github.com/wiki/dancannon/gorethink/gopher-and-thinker-s.png "Golang Gopher and RethinkDB Thinker")
1010

11-
Current version: v1.1.1 (RethinkDB v2.1)
11+
Current version: v1.1.3 (RethinkDB v2.1)
1212

1313
Please note that this version of the driver only supports versions of RethinkDB using the v0.4 protocol (any versions of the driver older than RethinkDB 2.0 will not work).
1414

Diff for: connection.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (c *Connection) sendQuery(q Query) error {
163163
}
164164

165165
// Set timeout
166-
if c.opts.Timeout == 0 {
166+
if c.opts.WriteTimeout == 0 {
167167
c.conn.SetWriteDeadline(time.Time{})
168168
} else {
169169
c.conn.SetWriteDeadline(time.Now().Add(c.opts.WriteTimeout))
@@ -189,7 +189,7 @@ func (c *Connection) nextToken() int64 {
189189
// could be read then an error is returned.
190190
func (c *Connection) readResponse() (*Response, error) {
191191
// Set timeout
192-
if c.opts.Timeout == 0 {
192+
if c.opts.ReadTimeout == 0 {
193193
c.conn.SetReadDeadline(time.Time{})
194194
} else {
195195
c.conn.SetReadDeadline(time.Now().Add(c.opts.ReadTimeout))

Diff for: doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package gorethink implements a Go driver for RethinkDB
22
//
3-
// Current version: v1.1.1 (RethinkDB v2.1)
3+
// Current version: v1.1.3 (RethinkDB v2.1)
44
// For more in depth information on how to use RethinkDB check out the API docs
55
// at http://rethinkdb.com/api
66
package gorethink

Diff for: encoding/decoder.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ func Decode(dst interface{}, src interface{}) (err error) {
5252

5353
// decode decodes the source value into the destination value
5454
func decode(dv, sv reflect.Value) {
55+
if dv.IsValid() {
56+
dv = indirect(dv, false)
57+
dv.Set(reflect.Zero(dv.Type()))
58+
}
59+
5560
valueDecoder(dv, sv)(dv, sv)
5661
}
5762

@@ -69,11 +74,6 @@ func valueDecoder(dv, sv reflect.Value) decoderFunc {
6974
return invalidValueDecoder
7075
}
7176

72-
if dv.IsValid() {
73-
dv = indirect(dv, false)
74-
dv.Set(reflect.Zero(dv.Type()))
75-
}
76-
7777
return typeDecoder(dv.Type(), sv.Type())
7878
}
7979

Diff for: encoding/decoder_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ type S13 struct {
124124
S8
125125
}
126126

127+
type PointerBasic struct {
128+
X int
129+
Y *int
130+
}
131+
127132
type Pointer struct {
128133
PPoint *Point
129134
Point Point
@@ -142,6 +147,11 @@ type Ambig struct {
142147
Second int `gorethink:"Hello"`
143148
}
144149

150+
// Decode test helper vars
151+
var (
152+
sampleInt = 2
153+
)
154+
145155
var decodeTests = []decodeTest{
146156
// basic types
147157
{in: true, ptr: new(bool), out: true},
@@ -253,6 +263,16 @@ var decodeTests = []decodeTest{
253263
ptr: new(Pointer),
254264
out: Pointer{PPoint: nil, Point: Point{Z: 2}},
255265
},
266+
{
267+
in: map[string]interface{}{"x": 2},
268+
ptr: new(PointerBasic),
269+
out: PointerBasic{X: 2, Y: nil},
270+
},
271+
{
272+
in: map[string]interface{}{"x": 2, "y": 2},
273+
ptr: new(PointerBasic),
274+
out: PointerBasic{X: 2, Y: &sampleInt},
275+
},
256276
}
257277

258278
func TestDecode(t *testing.T) {

Diff for: encoding/decoder_types.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ func interfaceDecoder(dv, sv reflect.Value) {
185185
}
186186

187187
func interfaceAsTypeDecoder(dv, sv reflect.Value) {
188-
decode(dv, sv.Elem())
188+
if !sv.IsNil() {
189+
decode(dv, sv.Elem())
190+
}
189191
}
190192

191193
type ptrDecoder struct {

0 commit comments

Comments
 (0)