mirror of
https://github.com/gofiber/storage.git
synced 2025-11-03 10:50:58 +08:00
🚀 feature: add bbolt implementation (#321)
* 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>
This commit is contained in:
20
bbolt/utils.go
Normal file
20
bbolt/utils.go
Normal file
@@ -0,0 +1,20 @@
|
||||
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))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user