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