diff options
author | amine <hilalyamine@gmail.com> | 2019-10-31 15:46:09 +0100 |
---|---|---|
committer | amine <hilalyamine@gmail.com> | 2019-10-31 15:46:09 +0100 |
commit | ab935674a26f2eef5d8014c615b9b5bc1f402135 (patch) | |
tree | 0a1283552ec54460fc3bef464ac26d61fc034066 /repository/config.go | |
parent | 11b4a1beb7e1ab8809515a5ce21e8708fba7f300 (diff) | |
download | git-bug-ab935674a26f2eef5d8014c615b9b5bc1f402135.tar.gz |
repository: config interface and implementation rework
Diffstat (limited to 'repository/config.go')
-rw-r--r-- | repository/config.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/repository/config.go b/repository/config.go new file mode 100644 index 00000000..a2bb33fd --- /dev/null +++ b/repository/config.go @@ -0,0 +1,23 @@ +package repository + +// Config represent the common function interacting with the repository config storage +type Config interface { + // Store writes a single key/value pair in the config of the repo + Store(key string, value string) error + + // ReadAll reads all key/value pair matching the key prefix + ReadAll(keyPrefix string) (map[string]string, error) + + // ReadBool read a single boolean value from the config + // Return ErrNoConfigEntry or ErrMultipleConfigEntry if + // there is zero or more than one entry for this key + ReadBool(key string) (bool, error) + + // ReadBool read a single string value from the config + // Return ErrNoConfigEntry or ErrMultipleConfigEntry if + // there is zero or more than one entry for this key + ReadString(key string) (string, error) + + // RemoveAll removes all key/value pair matching the key prefix + RemoveAll(keyPrefix string) error +} |