diff options
Diffstat (limited to 'repository/config_mem.go')
-rw-r--r-- | repository/config_mem.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/repository/config_mem.go b/repository/config_mem.go index e8809f5e..e2cffd9c 100644 --- a/repository/config_mem.go +++ b/repository/config_mem.go @@ -6,6 +6,8 @@ import ( "time" ) +var _ Config = &memConfig{} + type memConfig struct { config map[string]string } @@ -14,11 +16,19 @@ func newMemConfig(config map[string]string) *memConfig { return &memConfig{config: config} } -func (mc *memConfig) Store(key, value string) error { +func (mc *memConfig) StoreString(key, value string) error { mc.config[key] = value return nil } +func (mc *memConfig) StoreBool(key string, value bool) error { + return mc.StoreString(key, strconv.FormatBool(value)) +} + +func (mc *memConfig) StoreTimestamp(key string, value time.Time) error { + return mc.StoreString(key, strconv.Itoa(int(value.Unix()))) +} + func (mc *memConfig) ReadAll(keyPrefix string) (map[string]string, error) { result := make(map[string]string) for key, val := range mc.config { |