Skip to content

Commit

Permalink
Merge branch 'release/v2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dancannon committed Sep 20, 2016
2 parents e75f34b + 63ae4a0 commit 036953c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## v2.2.1 - 2016-09-18

### Added

- Added `State` and `Error` to `ChangeResponse`

### Fixed

- Fixed panic caused by cursor trying to read outstanding responses while closed
- Fixed panic when using mock session

## v2.2.0 - 2016-08-16

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

Current version: v2.2.0 (RethinkDB v2.3)
Current version: v2.2.1 (RethinkDB v2.3)

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).

Expand Down
11 changes: 9 additions & 2 deletions cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ func newCursor(conn *Connection, cursorType string, token int64, term *Term, opt
cursorType = "Cursor"
}

connOpts := &ConnectOpts{}
if conn != nil {
connOpts = conn.opts
}

cursor := &Cursor{
conn: conn,
connOpts: connOpts,
token: token,
cursorType: cursorType,
term: term,
Expand Down Expand Up @@ -53,6 +59,7 @@ type Cursor struct {
releaseConn func() error

conn *Connection
connOpts *ConnectOpts
token int64
cursorType string
term *Term
Expand Down Expand Up @@ -602,7 +609,7 @@ func (c *Cursor) seekCursor(bufferResponse bool) error {
for {
c.applyPendingSkips(bufferResponse) // if we are buffering the responses, skip can drain from the buffer

if bufferResponse && len(c.buffer) == 0 && len(c.responses) > 0 {
if bufferResponse && len(c.buffer) == 0 && len(c.responses) > 0 && !c.closed {
if err := c.bufferNextResponse(); err != nil {
return err
}
Expand Down Expand Up @@ -665,7 +672,7 @@ func (c *Cursor) bufferNextResponse() error {

var value interface{}
decoder := json.NewDecoder(bytes.NewBuffer(response))
if c.conn.opts.UseJSONNumber {
if c.connOpts.UseJSONNumber {
decoder.UseNumber()
}
err := decoder.Decode(&value)
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package gorethink implements a Go driver for RethinkDB
//
// Current version: v2.2.0 (RethinkDB v2.3)
// Current version: v2.2.1 (RethinkDB v2.3)
// For more in depth information on how to use RethinkDB check out the API docs
// at http://rethinkdb.com/api
package gorethink
6 changes: 4 additions & 2 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ type WriteResponse struct {
// ChangeResponse is a helper type used when dealing with changefeeds. The type
// contains both the value before the query and the new value.
type ChangeResponse struct {
NewValue interface{} `gorethink:"new_val"`
OldValue interface{} `gorethink:"old_val"`
NewValue interface{} `gorethink:"new_val,omitempty"`
OldValue interface{} `gorethink:"old_val,omitempty"`
State string `gorethink:"state,omitempty"`
Error string `gorethink:"error,omitempty"`
}

// RunOpts contains the optional arguments for the Run function.
Expand Down

0 comments on commit 036953c

Please sign in to comment.