Use concrete Item rather than an interface. Removes unnecessary dupe structs

This commit is contained in:
Asim
2015-05-23 21:25:55 +01:00
parent 74fd1fc989
commit b5dcbbe998
7 changed files with 34 additions and 121 deletions

View File

@@ -1,10 +1,14 @@
package store
type Store interface {
Get(string) (Item, error)
Get(string) (*Item, error)
Del(string) error
Put(Item) error
NewItem(string, []byte) Item
Put(*Item) error
}
type Item struct {
Key string
Value []byte
}
type options struct{}
@@ -19,7 +23,7 @@ func NewStore(addrs []string, opt ...Option) Store {
return newConsulStore(addrs, opt...)
}
func Get(key string) (Item, error) {
func Get(key string) (*Item, error) {
return DefaultStore.Get(key)
}
@@ -27,10 +31,6 @@ func Del(key string) error {
return DefaultStore.Del(key)
}
func Put(item Item) error {
func Put(item *Item) error {
return DefaultStore.Put(item)
}
func NewItem(key string, value []byte) Item {
return DefaultStore.NewItem(key, value)
}