MCPcopy
hub / github.com/etcd-io/bbolt / CreateBucketIfNotExists

Method CreateBucketIfNotExists

tx.go:125–127  ·  view source on GitHub ↗

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.

(name []byte)

Source from the content-addressed store, hash-verified

123// Returns an error if the bucket name is blank, or if the bucket name is too long.
124// The bucket instance is only valid for the lifetime of the transaction.
125func (tx *Tx) CreateBucketIfNotExists(name []byte) (*Bucket, error) {
126 return tx.root.CreateBucketIfNotExists(name)
127}
128
129// DeleteBucket deletes a bucket.
130// Returns an error if the bucket cannot be found or if the key represents a non-bucket value.

Callers 15

TestDB_Put_VeryLargeFunction · 0.45
TestBucket_StatsFunction · 0.45
TestBucket_Stats_LargeFunction · 0.45
createAndPutKeysFunction · 0.45
TestOpen_Size_LargeFunction · 0.45
TestDB_HugeValueFunction · 0.45
insertChunkFunction · 0.45

Calls

no outgoing calls

Tested by 15

TestDB_Put_VeryLargeFunction · 0.36
TestBucket_StatsFunction · 0.36
TestBucket_Stats_LargeFunction · 0.36
createAndPutKeysFunction · 0.36
TestOpen_Size_LargeFunction · 0.36
TestDB_HugeValueFunction · 0.36
insertChunkFunction · 0.36