mirror of
https://github.com/gofiber/storage.git
synced 2025-09-27 12:52:25 +08:00

* Update CI/CD tests. * Add Bbolt db. * Add README. * Add actions. * Drop go1.14 & go1.15 for bbolt. * Add support for go1.16 * Update config.go Co-authored-by: wernerr <rene.werner@verivox.com>
21 lines
430 B
Go
21 lines
430 B
Go
package bbolt
|
|
|
|
import (
|
|
"github.com/gofiber/utils"
|
|
"go.etcd.io/bbolt"
|
|
)
|
|
|
|
func createBucket(cfg Config, conn *bbolt.DB) error {
|
|
return conn.Update(func(tx *bbolt.Tx) error {
|
|
_, err := tx.CreateBucketIfNotExists(utils.UnsafeBytes(cfg.Bucket))
|
|
|
|
return err
|
|
})
|
|
}
|
|
|
|
func removeBucket(cfg Config, conn *bbolt.DB) error {
|
|
return conn.Update(func(tx *bbolt.Tx) error {
|
|
return tx.DeleteBucket(utils.UnsafeBytes(cfg.Bucket))
|
|
})
|
|
}
|