From e05e34c332d4c085119ec8fa881ed5351d1ba962 Mon Sep 17 00:00:00 2001 From: Patrick Mezard Date: Wed, 21 Oct 2015 10:55:50 +0200 Subject: bucket: document buckets are valid only during the transaction Issue #313 --- tx.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tx.go') diff --git a/tx.go b/tx.go index cb60149..fe6c287 100644 --- a/tx.go +++ b/tx.go @@ -87,18 +87,21 @@ func (tx *Tx) Stats() TxStats { // Bucket retrieves a bucket by name. // Returns nil if the bucket does not exist. +// The bucket instance is only valid for the lifetime of the transaction. func (tx *Tx) Bucket(name []byte) *Bucket { return tx.root.Bucket(name) } // CreateBucket creates a new bucket. // Returns an error if the bucket already exists, if the bucket name is blank, or if the bucket name is too long. +// The bucket instance is only valid for the lifetime of the transaction. func (tx *Tx) CreateBucket(name []byte) (*Bucket, error) { return tx.root.CreateBucket(name) } // CreateBucketIfNotExists creates a new bucket if it doesn't already exist. // Returns an error if the bucket name is blank, or if the bucket name is too long. +// The bucket instance is only valid for the lifetime of the transaction. func (tx *Tx) CreateBucketIfNotExists(name []byte) (*Bucket, error) { return tx.root.CreateBucketIfNotExists(name) } -- cgit v1.2.3