aboutsummaryrefslogtreecommitdiffstats
path: root/repository/config_mem.go
diff options
context:
space:
mode:
authoramine <hilalyamine@gmail.com>2019-11-01 18:39:45 +0100
committeramine <hilalyamine@gmail.com>2019-11-01 18:39:45 +0100
commit104224c9f081fbe79757976a8c1f903ae94c3f8a (patch)
treeab3f954fe9ba86099c1606cf0fb074834d318834 /repository/config_mem.go
parent7f177c4750b4acf70cc3fd3d43c19685179e527b (diff)
downloadgit-bug-104224c9f081fbe79757976a8c1f903ae94c3f8a.tar.gz
repository: add StoreTimestamp/StoreBool to the config interface
repository: move the gitVersion logic to *gitConfig struct
Diffstat (limited to 'repository/config_mem.go')
-rw-r--r--repository/config_mem.go12
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 {