All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
- Replaced
UseOutdated
withReadMode
- Added
EmergencyRepair
andNonVotingReplicaTags
toReconfigureOpts
- Added
Union
as a root term - Added
Branch
as a root term - Added
ReadTimeout
andWriteTimeout
toRunOpts
andExecOpts
- Exported
github.com/Sirupsen/logrus.Logger
asLog
- Added support for encoding maps with non-string keys
- Added 'Round', 'Ceil' and 'Floor' terms
- Added race detector to CI
- Changed
Timeout
connect argument to only configure the connection timeout. - Replaced
Db
withDB
inRunOpts
andExecOpts
(Db
still works for now) - Made
Cursor
andSession
safe for concurrent use - Replaced
ErrClusterClosed
withErrConnectionClosed
- Deprecated
UseOutdated
optional argument - Deprecated
Db
inRunOpt
- Fixed race condition in node pool
- Fixed node refresh issue with RethinkDB 2.1 due to an API change
- Fixed encoding errors not being returned when running queries
1.0.0 is finally here, This is the first stable production ready release of GoRethink!
In an attempt to make this library more "idiomatic" some functions have been renamed, for the full list of changes and bug fixes see below.
- Added more documentation.
- Added
Shards
,Replicas
andPrimaryReplicaTag
optional arguments inTableCreateOpts
. - Added
MultiGroup
andMultiGroupByIndex
which are equivalent to the runninggroup
with themulti
optional argument set to true.
- Renamed
Db
toDB
. - Renamed
DbCreate
toDBCreate
. - Renamed
DbDrop
toDBDrop
. - Renamed
RqlConnectionError
toRQLConnectionError
. - Renamed
RqlDriverError
toRQLDriverError
. - Renamed
RqlClientError
toRQLClientError
. - Renamed
RqlRuntimeError
toRQLRuntimeError
. - Renamed
RqlCompileError
toRQLCompileError
. - Renamed
Js
toJS
. - Renamed
Json
toJSON
. - Renamed
Http
toHTTP
. - Renamed
GeoJson
toGeoJSON
. - Renamed
ToGeoJson
toToGeoJSON
. - Renamed
WriteChanges
toChangeResponse
, this is now a general type and can be used when dealing with changefeeds. - Removed depth limit when encoding values using
Expr
- Fixed issue causing errors when closing a changefeed cursor (#191)
- Fixed issue causing nodes to remain unhealthy when host discovery is disabled (#195)
- Fixed issue causing driver to fail when connecting to DB which did not have its canonical address set correctly (#200).
- Fixed ongoing queries not being properly stopped when closing the cursor.
- Removed
CacheSize
andDataCenter
optional arguments inTableCreateOpts
. - Removed
CacheSize
optional argument fromInsertOpts
- Added support for connecting to a server using TLS (#179)
- Fixed issue causing driver to fail to connect to servers with the HTTP admin interface disabled (#181)
- Fixed errors in documentation (#182, #184)
- Fixed RunWrite not closing the cursor (#185)
- Improved logging of connection errors.
- Fixed bug causing empty times to be inserted into the DB even when the omitempty tag was set.
- Fixed node status refresh loop leaking goroutines.
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:
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
cursor, err := r.Table("items").Changes()
ch := make(chan map[string]interface{})
cursor.Listen(ch)
For more details checkout the README and godoc. As always if you have any further questions send me a message on Gitter.
- 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 toConnectOpts
, when this value istrue
the driver will listen for new nodes added to the cluster. - Added the
Addresses
optional argument toConnectOpts
, this allows the driver to connect to multiple nodes in a cluster. - Added the
IncludeStates
optional argument toChanges
. - Added
MinVal
andMaxVal
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 theCursor
, by default this value will be "Cursor" unless using a changefeed. - Changed the
IndexesOf
function toOffsetsOf
. - 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
- Fixed dropped millisecond precision if given value is too old
- Add
IdentifierFormat
optarg toTableOpts
(#158)
- Fix struct alignment for ARM and x86-32 builds (#153)
- Fix sprintf format for geometry error message (#157)
- Fix duplicate if block (#159)
- Fix incorrect assertion in decoder tests
- Fixed
writeQuery
being too small when sending large queries
- Reduce GC by using buffers when reading and writing
- Fixed encoding
time.Time
ignoring millseconds - Fixed pointers in structs that implement the
Marshaler
/Unmarshaler
interfaces being ignored
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 thedatabase/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 toMaxOpen
IdleTimeout
renamed toTimeout
Cursor
s are now only closed automatically when calling eitherAll
orOne
Exec
now takesExecOpts
instead ofRunOpts
. The only difference is thatExec
has theNoReply
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.
- Fixed empty slices being returned as
[]T(nil)
not[]T{}
#138
- Added geospatial terms (
Circle
,Distance
,Fill
,Geojson
,ToGeojson
,GetIntersecting
,GetNearest
,Includes
,Intersects
,Line
,Point
,Polygon
,PolygonSub
) - Added
UUID
term for generating unique IDs - Added
AtIndex
term, combinesNth
andGetField
- Added the
Geometry
type, see the types package - Updated the
BatchConf
field inRunOpts
, now uses theBatchOpts
type - Removed support for the
FieldMapper
interface
Internal Changes
- Fixed encoding performance issues, greatly improves writes/second
- Updated
Next
to zero the destination value every time it is called.
- Fixed issue causing
Close
to start an infinite loop - Tidied up connection closing logic
- Fixed bug causing Pseudotypes to not be decoded properly (#117)
- Updated github.com/fatih/pool to v2 (#118)
- Updated the driver to support RethinkDB v1.14 (#116)
- Added the Binary data type
- Added the Binary command which takes a
[]byte
orbytes.Buffer{}
as an argument. - Added the
BinaryFormat
optional argument toRunOpts
- Added the
GroupFormat
optional argument toRunOpts
- Added the
ArrayLimit
optional argument toRunOpts
- Renamed the
ReturnVals
optional argument toReturnChanges
- Renamed the
Upsert
optional argument toConflict
- Added the
IndexRename
command - Updated
Distinct
to now take theIndex
optional argument (usingDistinctOpts
)
Internal Changes
- Updated to use the new JSON protocol
- Switched the connection pool code to use github.com/fatih/pool
- Added some benchmarks
- Fixed issue causing connections not to be closed correctly (#109)
- Fixed issue causing terms in optional arguments to be encoded incorrectly (#114)
- Fixed "Token ## not in stream cache" error (#103)
- Changed Exec to no longer use NoReply. It now waits for the server to respond.
- Replaced
ResultRows
/ResultRow
withCursor
,Cursor
has theNext
,All
andOne
methods which stores the relevant value in the value pointed at by result. For more information check the examples. - Changed the time constants (Days and Months) to package globals instead of functions
- Added the
Args
term and changed the arguments for many terms toargs ...interface{}
to allow argument splicing - Added the
Changes
term and support for the feed response type - Added the
Random
term - Added the
Http
term - The second argument for
Slice
is now optional EqJoin
now accepts a function as its first argumentNth
now returns a selection
- Changed
Connect
to useConnectOpts
instead ofmap[string]interface{}
- Migrated to new
Group
/Ungroup
functions, these replaceGroupedMapReduce
andGroupBy
- Added new aggregators
- Removed base parameter for
Reduce
- Added
Object
function - Added
Upcase
,Downcase
andSplit
string functions - Added
GROUPED_DATA
pseudotype - Fixed query printing
- Added noreply writes
- Added the new terms
index_status
,index_wait
andsync
- Added the profile flag to the run functions
- Optional arguments are now structs instead of key, pair strings. Almost all of the struct fields are of type interface{} as they can have terms inside them. For example:
r.TableCreateOpts{ PrimaryKey: r.Expr("index") }
- Returned arrays are now properly loaded into ResultRows. In the past when running
r.Expr([]interface{}{1,2,3})
would require you to useRunRow
followed byScan
. You can now useRun
followed byScanAll