dancannon/gorethink — pull request #96 by anonx (2014-06-19 20:19:39+00:00)
Title: Changefeeds

The list of commits includes:

1. Update of proto file to the latest version (0.3)
2. Update of the protocol to the latest version (0.3) but still protobuf based
3. New ``Changes()`` command

According to the [RethinkDB documentation](http://rethinkdb.com/api/python/changes/) the command should be used in the following way:

**Client 1**
```
type TestData struct {
NewVal map[string]interface{} `gorethink:"new_val"`
OldVal map[string]interface{} `gorethink:"old_val"`
}

//
// It is a good idea to open changefeeds on their own connection
//

rows, err := Db("test").Table("test").Changes().Run(sess)
c.Assert(err, test.IsNil)

// Unlike other cursors, the cursor returned by the Changes command doesn't terminate
// When you iterate through all the elements, the cursor blocks until more elements are available
for rows.Next() {
var row TestData
err := rows.Scan(&row)
c.Assert(err, test.IsNil)

// ToDo something with New / Old value
}
```

**Client 2**
```
Db("test").Table("test").Insert(...).Exec(sess)
Db("test").Table("test").Get(...).Update(...).Exec(sess)
Db("test").Table("test").Get(...).Delete(...).Exec(sess)
```

The command part **should be** somehow covered by tests in ``query_table_test.go`` file. So, ppl, please help if you can.