-
Notifications
You must be signed in to change notification settings - Fork 199
/
storerStub.go
43 lines (34 loc) · 944 Bytes
/
storerStub.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package mock
type StorerStub struct {
PutCalled func(key, data []byte) error
GetCalled func(key []byte) ([]byte, error)
HasCalled func(key []byte) error
RemoveCalled func(key []byte) error
ClearCacheCalled func()
DestroyUnitCalled func() error
}
func (ss *StorerStub) Close() error {
return nil
}
func (ss *StorerStub) Put(key, data []byte) error {
return ss.PutCalled(key, data)
}
func (ss *StorerStub) Get(key []byte) ([]byte, error) {
return ss.GetCalled(key)
}
func (ss *StorerStub) Has(key []byte) error {
return ss.HasCalled(key)
}
func (ss *StorerStub) Remove(key []byte) error {
return ss.RemoveCalled(key)
}
func (ss *StorerStub) ClearCache() {
ss.ClearCacheCalled()
}
func (ss *StorerStub) DestroyUnit() error {
return ss.DestroyUnitCalled()
}
// IsInterfaceNil returns true if there is no value under the interface
func (ss *StorerStub) IsInterfaceNil() bool {
return ss == nil
}