21 lines
340 B
Go
21 lines
340 B
Go
package settings
|
|
|
|
import "github.com/evcc-io/evcc/api/store"
|
|
|
|
type storer struct {
|
|
key string
|
|
}
|
|
|
|
var _ store.Store = (*storer)(nil)
|
|
|
|
func NewStore(key string) store.Store {
|
|
return &storer{key: key}
|
|
}
|
|
|
|
func (s *storer) Load(res any) error {
|
|
return Json(s.key, &res)
|
|
}
|
|
|
|
func (s *storer) Save(val any) error {
|
|
return SetJson(s.key, val)
|
|
}
|