Skip to content

Commit

Permalink
Merge branch 'release/v0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
dancannon committed Feb 1, 2015
2 parents 3d6f580 + ecb30e7 commit 2e7684d
Show file tree
Hide file tree
Showing 42 changed files with 3,148 additions and 1,939 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## v0.6.0 - 1 Feb 2015

There are some major changes to the driver with this release that are not related to the RethinkDB v1.16 release. Please have a read through them:
- Improvements to result decoding by caching reflection calls.
- Finished implementing the `Marshaler`/`Unmarshaler` interfaces
- Connection pool overhauled. There were a couple of issues with connections in the previous releases so this release replaces the `fatih/pool` package with a connection pool based on the `database/sql` connection pool.
- Another change is the removal of the prefetching mechanism as the connection+cursor logic was becoming quite complex and causing bugs, hopefully this will be added back in the near future but for now I am focusing my efforts on ensuring the driver is as stable as possible #130 #137
- Due to the above change the API for connecting has changed slightly (The API is now closer to the `database/sql` API. `ConnectOpts` changes:
- `MaxActive` renamed to `MaxOpen`
- `IdleTimeout` renamed to `Timeout`
- `Cursor`s are now only closed automatically when calling either `All` or `One`
- `Exec` now takes `ExecOpts` instead of `RunOpts`. The only difference is that `Exec` has the `NoReply` field

With that out the way here are the v1.16 changes:

- Added `Range` which generates all numbers from a given range
- Added an optional squash argument to the changes command, which lets the server combine multiple changes to the same document (defaults to true)
- Added new admin functions (`Config`, `Rebalance`, `Reconfigure`, `Status`, `Wait`)
- Added support for `SUCCESS_ATOM_FEED`
- Added `MinIndex` + `MaxInde`x functions
- Added `ToJSON` function
- Updated `WriteResponse` type

Since this release has a lot of changes and although I have tested these changes sometimes things fall through the gaps. If you discover any bugs please let me know and I will try to fix them as soon as possible.

## Hotfix - 14 Dec 2014

- Fixed empty slices being returned as `[]T(nil)` not `[]T{}` #138
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
GoRethink - RethinkDB Driver for Go [![wercker status](https://app.wercker.com/status/e315e764041af8e80f0c68280d4b4de2/s/master "wercker status")](https://app.wercker.com/project/bykey/e315e764041af8e80f0c68280d4b4de2) [![GoDoc](https://godoc.org/github.com/dancannon/gorethink?status.png)](https://godoc.org/github.com/dancannon/gorethink)
=====================
# GoRethink - RethinkDB Driver for Go

[Go](http://golang.org/) driver for [RethinkDB](http://www.rethinkdb.com/) made by [Daniel Cannon](http://github.com/dancannon) and based off of Christopher Hesse's [RethinkGo](https://github.com/christopherhesse/rethinkgo) driver.
[![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)

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

Current version: v0.5.0 (RethinkDB v1.15.1)

**Version 0.3 introduced some API changes, for more information check the [change log](CHANGELOG.md)**
Current version: v0.6.0 (RethinkDB v1.16.0)

**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**

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

## Installation

Expand Down Expand Up @@ -41,7 +46,9 @@ See the [documentation](http://godoc.org/github.com/dancannon/gorethink#Connect)

### Connection Pool

The driver uses a connection pool at all times, however by default there is only a single connection available. In order to turn this into a proper connection pool, we need to pass the `maxIdle`, `maxActive` and/or `idleTimeout` parameters to Connect():
The driver uses a connection pool at all times, by default it creates and frees connections automatically. It's safe for concurrent use by multiple goroutines.

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 (
Expand All @@ -54,16 +61,18 @@ session, err := r.Connect(r.ConnectOpts{
Address: "localhost:28015",
Database: "test",
MaxIdle: 10,
IdleTimeout: time.Second * 10,
MaxOpen: 10,
})

if err != nil {
log.Fatalln(err.Error())
}

session.SetMaxOpenConns(5)
```

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


## Query Functions

This library is based on the official drivers so the code on the [API](http://www.rethinkdb.com/api/) page should require very few changes to work.
Expand Down Expand Up @@ -112,7 +121,7 @@ Different result types are returned depending on what function is used to execut
- `Run` returns a cursor which can be used to view
all rows returned.
- `RunWrite` returns a WriteResponse and should be used for queries such as Insert,Update,etc...
- `Exec` sends a query to the server with the noreply flag set and returns immediately
- `Exec` sends a query to the server and closes the connection immediately after reading the response from the database. If you do not wish to wait for the response then you can set the `NoReply` flag.

Example:

Expand Down
Loading

0 comments on commit 2e7684d

Please sign in to comment.