filebrowser/storage/bolt/utils.go

23 lines
411 B
Go
Raw Normal View History

package bolt
import (
2024-04-01 16:24:06 +00:00
"errors"
"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"
)
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
}
return err
}
func save(db *storm.DB, name string, from interface{}) error {
return db.Set("config", name, from)
}