While in the past, we have had the go-couchbase project which does provide access to many of Couchbase’s features, it was primarily intended to be used internally to our company. gocb marks the first preview of an upcoming release designed and developed specifically to meet the goals of Go developers using Couchbase.
The gocb project is implemented as a set of blocking methods which can be used concurrently from as many goroutines as desired. It is suggested that you distribute your workload across as many goroutines that fit within your application design to maximize the parallelism of the library.
You can find an API reference for the gocb project at: http://godoc.org/github.com/couchbaselabs/gocb/.
Performing Basic Operations
Performing View Queries
While the logging that is available within gocb is still in its infancy, it can provide a great deal of useful information for debugging. Setting up gocbcore to log to the console is quite trivial using a built in logger object. Make sure to only call this once at the beginning of your application though as the logger is assumed to be immutable once any other methods are invoked.
Go SDK Architecture
The gocb library
The gocb library is our developer oriented library intended to provide a simple and easy to use interface to users. This library implements a blocking API which exposes all of our developer oriented functionality to you.
The gocbcore library
The gocbcore library is our internal library which provides all of the network and smart management functionality of the client. This library provides is used by gocb internally.
gocbcore implements a mostly lockless method of dispatching operations, giving your application the ability to easily distribute the load across as many cores as servers in your cluster. This means better performance, and the ability to safely use the client across as many goroutines as you desire without incuring any performance penalty.