Use concrete Item rather than an interface. Removes unnecessary dupe structs
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user