Files
filebrowser/storage/bolt/utils.go
T

23 lines
411 B
Go
Raw Normal View History

2019-01-05 22:44:33 +00:00
package bolt
import (
2024-04-01 18:24:06 +02:00
"errors"
2022-05-04 00:48:45 +04:00
"github.com/asdine/storm/v3"
2020-06-01 01:12:36 +02:00
2024-04-01 18:24:06 +02: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 18:24:06 +02: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)
}