The Go SDK also comes with some convenience functionality for common Couchbase management requests.
ClusterManager interface (obtained via Cluster.Manager(username, password string)) (administrative username and password).
BucketManager interface (obtained via Bucket.Manager(username, password string)) (cluster or bucket credentials).
The ClusterManager interface may be used to create and delete buckets from the Couchbase cluster. It is instantiated through the Cluster's Manager method, providing the administrative username and password.
To create a bucket, use the ClusterManager's InsertBucket(settings *BucketSettings) method. The BucketSettings struct is also used to expose information about existing buckets (ClusterManager.GetBuckets() returns a slice of settings) or to update an existing bucket (ClusterManager.UpdateBucket(settings *BucketSettings)).
Name: The name of the bucket (mandatory to create one, cannot be updated).
Type: The type of the bucket (mandatory to create one, cannot be changed). Defaults to BucketType.Couchbase, but can also be BucketType.Memcached to create a cache bucket.
Quota: How much memory should each node use for the bucket. This number is specified in megabytes.
Password: If specified, makes this bucket password protected, forcing future connects (using the Bucket) interface to specify the password parameter.
FlushEnabled: Enables the BucketManager#flush() operation to be performed on this bucket (see the Flushing Buckets section below).
Replicas: The number of replicas to use for the bucket.
IndexReplicas: Wether or not to replicate indexes.
You may flush a bucket in the Go SDK by using the BucketManager.Flush() method (for an example of connecting to the BucketManager, see the Index Management section below).
"_": "Flush is disabled for the bucket"
In the Go SDK, design documents are represented by the DesignDocument and View structs. All operations on design documents are performed on a BucketManager instance.
To inspect design documents, you can either retrieve them by name (bucketManager.GetDesignDocument("landmarks")) or iterate through a slice of documents (bucketManager.GetDesignDocuments()).
To create or update design documents, use the InsertDesignDocument(ddoc *DesignDocument) and UpsertDesignDocument(ddoc *DesignDocument) methods.
To remove a design document from a bucket, pass its name to the RemoveDesignDocument method.