2019-01-05 22:44:33 +00:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
2024-04-01 16:24:06 +00:00
|
|
|
"errors"
|
|
|
|
|
2022-05-03 20:48:45 +00:00
|
|
|
"github.com/asdine/storm/v3"
|
2020-05-31 23:12:36 +00:00
|
|
|
|
2024-04-01 16:24:06 +00:00
|
|
|
fbErrors "github.com/filebrowser/filebrowser/v2/errors"
|
2019-01-05 22:44:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func get(db *storm.DB, name string, to interface{}) error {
|
|
|
|
err := db.Get("config", name, to)
|
2024-04-01 16:24:06 +00:00
|
|
|
if errors.Is(err, storm.ErrNotFound) {
|
|
|
|
return fbErrors.ErrNotExist
|
2019-01-05 22:44:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
func save(db *storm.DB, name string, from interface{}) error {
|
|
|
|
return db.Set("config", name, from)
|
|
|
|
}
|