forked from jakevoytko/go-stringmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stringmap.go
20 lines (19 loc) · 884 Bytes
/
stringmap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package stringmap
// StringMap stores key/value string pairs. It is always synchronous, but may be
// stored outside the memory space of the program. For instance, in Redis.
type StringMap interface {
// Has returns whether or not key is present.
Has(key string) (bool, error)
// Get returns the given key. Error if key is not present.
Get(key string) (string, error)
// Set sets the given key. Allowed to overwrite.
Set(key, value string) error
// Delete deletes the given key. Error if key is not present.
Delete(key string) error
// GetAll returns every entry as a map.
GetAll() (map[string]string, error)
// Scan finds all keys that match the given pattern. It uses *-style wildcard
// matching. It is not guaranteed to find all of the keys if keys are being
// added and removed during the search in a separate thread.
ScanKeys(pattern string) ([]string, error)
}