filebrowser/storage/bolt/utils.go

21 lines
380 B
Go
Raw Normal View History

package bolt
import (
"github.com/asdine/storm/v3"
2020-05-31 23:12:36 +00:00
"github.com/filebrowser/filebrowser/v2/errors"
)
func get(db *storm.DB, name string, to interface{}) error {
err := db.Get("config", name, to)
if err == storm.ErrNotFound {
return errors.ErrNotExist
}
return err
}
func save(db *storm.DB, name string, from interface{}) error {
return db.Set("config", name, from)
}