Skip to content

Commit

Permalink
Merge branch 'release/v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dancannon committed Apr 14, 2015
2 parents 627a8ee + aa61a59 commit 7d5c2ac
Show file tree
Hide file tree
Showing 34 changed files with 1,749 additions and 539 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: go

gobuild_args: -tags='cluster'

go:
- 1.4
- tip

before_install:
- wget http://download.rethinkdb.com/dev/2.0.0-0RC1/rethinkdb_2.0.0%2b0RC1~0precise_amd64.deb
- sudo dpkg -i rethinkdb_2.0.0+0RC1~0precise_amd64.deb

before_script:
# - sudo add-apt-repository ppa:rethinkdb/ppa -y
# - sudo apt-get update -q
# - sudo apt-get install rethinkdb
- rethinkdb > /dev/null 2>&1 &
- rethinkdb --port-offset 1 --directory rethinkdb_data1 --join localhost:29016 > /dev/null 2>&1 &
- rethinkdb --port-offset 2 --directory rethinkdb_data2 --join localhost:29016 > /dev/null 2>&1 &
- rethinkdb --port-offset 3 --directory rethinkdb_data3 --join localhost:29016 > /dev/null 2>&1 &
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## v0.7.0 - 2015-03-30

This release includes support for RethinkDB 2.0 and connecting to clusters. To connect to a cluster you should use the new `Addresses` field in `ConnectOpts`, for example:

```go
session, err := r.Connect(r.ConnectOpts{
Addresses: []string{"localhost:28015", "localhost:28016"},
})
if err != nil {
log.Fatalln(err.Error())
}
```

Also added was the ability to read from a cursor using a channel, this is especially useful when using changefeeds. For more information see this [gist](https://gist.github.com/dancannon/2865686d163ed78bbc3c)

```go
cursor, err := r.Table("items").Changes()
ch := make(chan map[string]interface{})
cursor.Listen(ch)
```

For more details checkout the [README](https://github.com/dancannon/gorethink/blob/master/README.md) and [godoc](https://godoc.org/github.com/dancannon/gorethink). As always if you have any further questions send me a message on [Gitter](https://gitter.im/dancannon/gorethink).

- Added the ability to connect to multiple nodes, queries are then distributed between these nodes. If a node stops responding then queries stop being sent to this node.
- Added the `DiscoverHosts` optional argument to `ConnectOpts`, when this value is `true` the driver will listen for new nodes added to the cluster.
- Added the `Addresses` optional argument to `ConnectOpts`, this allows the driver to connect to multiple nodes in a cluster.
- Added the `IncludeStates` optional argument to `Changes`.
- Added `MinVal` and `MaxVal` which represent the smallest and largest possible values.
- Added the `Listen` cursor helper function which publishes database results to a channel.
- Added support for optional arguments for the `Wait` function.
- Added the `Type` function to the `Cursor`, by default this value will be "Cursor" unless using a changefeed.
- Changed the `IndexesOf` function to `OffsetsOf` .
- Changed driver to use the v0.4 protocol (used to use v0.3).
- Fixed geometry tests not properly checking the expected results.
- Fixed bug causing nil pointer panics when using an `Unmarshaler`

## v0.6.3 - 2015-03-04
### Added
Expand Down
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

[![GitHub tag](https://img.shields.io/github/tag/dancannon/gorethink.svg?style=flat)]()
[![GoDoc](https://godoc.org/github.com/dancannon/gorethink?status.png)](https://godoc.org/github.com/dancannon/gorethink)
[![wercker status](https://app.wercker.com/status/e315e764041af8e80f0c68280d4b4de2/s/master "wercker status")](https://app.wercker.com/project/bykey/e315e764041af8e80f0c68280d4b4de2)
[![build status](https://img.shields.io/travis/dancannon/gorethink/master.svg "build status")](https://travis-ci.org/dancannon/gorethink)

[Go](http://golang.org/) driver for [RethinkDB](http://www.rethinkdb.com/)


Current version: v0.6.3 (RethinkDB v1.16)

**Version 0.6 introduced some small API changes and some significant internal changes, for more information check the [change log](CHANGELOG.md) and please be aware the driver is not yet stable**
Current version: v0.7.0 (RethinkDB v2.0)

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dancannon/gorethink?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Expand All @@ -32,11 +30,7 @@ import (

var session *r.Session

session, err := r.Connect(r.ConnectOpts{
Address: "localhost:28015",
Database: "test",
})

session, err := Connect(address)
if err != nil {
log.Fatalln(err.Error())
}
Expand All @@ -51,14 +45,10 @@ The driver uses a connection pool at all times, by default it creates and frees
To configure the connection pool `MaxIdle`, `MaxOpen` and `IdleTimeout` can be specified during connection. If you wish to change the value of `MaxIdle` or `MaxOpen` during runtime then the functions `SetMaxIdleConns` and `SetMaxOpenConns` can be used.

```go
import (
r "github.com/dancannon/gorethink"
)

var session *r.Session

session, err := r.Connect(r.ConnectOpts{
Address: "localhost:28015",
Address: "localhost:28015",
Database: "test",
MaxIdle: 10,
MaxOpen: 10,
Expand All @@ -70,7 +60,25 @@ if err != nil {
session.SetMaxOpenConns(5)
```

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

To connect to a RethinkDB cluster which has multiple nodes you can use the following syntax.

```go
var session *r.Session

session, err := r.Conenct(r.ConnectOpts{
Addresses: []string{"localhost:28015", "localhost:28016"},
Database: "test",
AuthKey: "14daak1cad13dj",
DiscoverHosts: true,
}, "localhost:28015")
if err != nil {
log.Fatalln(err.Error())
}
```

When `DiscoverHosts` is true any nodes are added to the cluster after the initial connection then the new node will be added to the pool of available nodes used by GoRethink.


## Query Functions
Expand Down
Loading

0 comments on commit 7d5c2ac

Please sign in to comment.