filebrowser/bolt/config.go

24 lines
412 B
Go
Raw Normal View History

2017-08-19 19:35:44 +08:00
package bolt
import (
"github.com/asdine/storm"
2017-08-20 15:42:38 +08:00
fm "github.com/hacdias/filemanager"
2017-08-19 19:35:44 +08:00
)
type ConfigStore struct {
DB *storm.DB
}
func (c ConfigStore) Get(name string, to interface{}) error {
2017-08-20 15:42:38 +08:00
err := c.DB.Get("config", name, to)
if err == storm.ErrNotFound {
return fm.ErrNotExist
}
return err
2017-08-19 19:35:44 +08:00
}
func (c ConfigStore) Save(name string, from interface{}) error {
return c.DB.Set("config", name, from)
}