2019-01-06 06:44:33 +08:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/asdine/storm"
|
2020-06-01 07:12:36 +08:00
|
|
|
|
2019-01-06 06:44:33 +08: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)
|
|
|
|
}
|