Documentation
¶
Index ¶
- type RedisMock
- func (mock *RedisMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
- func (mock *RedisMock) CheckerCalls() []struct{ ... }
- func (mock *RedisMock) DeleteValue(ctx context.Context, key string) error
- func (mock *RedisMock) DeleteValueCalls() []struct{ ... }
- func (mock *RedisMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
- func (mock *RedisMock) GetKeyValuePairsCalls() []struct{ ... }
- func (mock *RedisMock) GetKeys(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error)
- func (mock *RedisMock) GetKeysCalls() []struct{ ... }
- func (mock *RedisMock) GetSetMemberCount(ctx context.Context, setKey string) (int64, error)
- func (mock *RedisMock) GetSetMemberCountCalls() []struct{ ... }
- func (mock *RedisMock) GetSetMemberValues(ctx context.Context, setKey string, matchPattern string, valuePrefix string, ...) (map[string]string, uint64, error)
- func (mock *RedisMock) GetSetMemberValuesCalls() []struct{ ... }
- func (mock *RedisMock) GetTotalKeys(ctx context.Context) (int64, error)
- func (mock *RedisMock) GetTotalKeysCalls() []struct{ ... }
- func (mock *RedisMock) GetValue(ctx context.Context, key string) (string, error)
- func (mock *RedisMock) GetValueCalls() []struct{ ... }
- func (mock *RedisMock) SetAdd(ctx context.Context, key string, members ...interface{}) error
- func (mock *RedisMock) SetAddCalls() []struct{ ... }
- func (mock *RedisMock) SetRem(ctx context.Context, key string, members ...interface{}) error
- func (mock *RedisMock) SetRemCalls() []struct{ ... }
- func (mock *RedisMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (mock *RedisMock) SetValueCalls() []struct{ ... }
- func (mock *RedisMock) Transaction(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error)
- func (mock *RedisMock) TransactionCalls() []struct{ ... }
- type StorerMock
- func (mock *StorerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (mock *StorerMock) CheckerCalls() []struct{ ... }
- func (mock *StorerMock) DeleteValue(ctx context.Context, key string) error
- func (mock *StorerMock) DeleteValueCalls() []struct{ ... }
- func (mock *StorerMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
- func (mock *StorerMock) GetKeyValuePairsCalls() []struct{ ... }
- func (mock *StorerMock) GetKeys(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error)
- func (mock *StorerMock) GetKeysCalls() []struct{ ... }
- func (mock *StorerMock) GetSetMemberCount(ctx context.Context, setKey string) (int64, error)
- func (mock *StorerMock) GetSetMemberCountCalls() []struct{ ... }
- func (mock *StorerMock) GetSetMemberValues(ctx context.Context, setKey string, matchPattern string, valuePrefix string, ...) (map[string]string, uint64, error)
- func (mock *StorerMock) GetSetMemberValuesCalls() []struct{ ... }
- func (mock *StorerMock) GetTotalKeys(ctx context.Context) (int64, error)
- func (mock *StorerMock) GetTotalKeysCalls() []struct{ ... }
- func (mock *StorerMock) GetValue(ctx context.Context, key string) (string, error)
- func (mock *StorerMock) GetValueCalls() []struct{ ... }
- func (mock *StorerMock) SetAdd(ctx context.Context, key string, members ...interface{}) error
- func (mock *StorerMock) SetAddCalls() []struct{ ... }
- func (mock *StorerMock) SetRem(ctx context.Context, key string, members ...interface{}) error
- func (mock *StorerMock) SetRemCalls() []struct{ ... }
- func (mock *StorerMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (mock *StorerMock) SetValueCalls() []struct{ ... }
- func (mock *StorerMock) Transaction(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error)
- func (mock *StorerMock) TransactionCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisMock ¶
type RedisMock struct {
// CheckerFunc mocks the Checker method.
CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
// DeleteValueFunc mocks the DeleteValue method.
DeleteValueFunc func(ctx context.Context, key string) error
// GetKeyValuePairsFunc mocks the GetKeyValuePairs method.
GetKeyValuePairsFunc func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
// GetKeysFunc mocks the GetKeys method.
GetKeysFunc func(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error)
// GetSetMemberCountFunc mocks the GetSetMemberCount method.
GetSetMemberCountFunc func(ctx context.Context, setKey string) (int64, error)
// GetSetMemberValuesFunc mocks the GetSetMemberValues method.
GetSetMemberValuesFunc func(ctx context.Context, setKey string, matchPattern string, valuePrefix string, count int64, cursor uint64) (map[string]string, uint64, error)
// GetTotalKeysFunc mocks the GetTotalKeys method.
GetTotalKeysFunc func(ctx context.Context) (int64, error)
// GetValueFunc mocks the GetValue method.
GetValueFunc func(ctx context.Context, key string) (string, error)
// SetAddFunc mocks the SetAdd method.
SetAddFunc func(ctx context.Context, key string, members ...interface{}) error
// SetRemFunc mocks the SetRem method.
SetRemFunc func(ctx context.Context, key string, members ...interface{}) error
// SetValueFunc mocks the SetValue method.
SetValueFunc func(ctx context.Context, key string, value interface{}, expiration time.Duration) error
// TransactionFunc mocks the Transaction method.
TransactionFunc func(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error)
// contains filtered or unexported fields
}
RedisMock is a mock implementation of store.Redis.
func TestSomethingThatUsesRedis(t *testing.T) {
// make and configure a mocked store.Redis
mockedRedis := &RedisMock{
CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
DeleteValueFunc: func(ctx context.Context, key string) error {
panic("mock out the DeleteValue method")
},
GetKeyValuePairsFunc: func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error) {
panic("mock out the GetKeyValuePairs method")
},
GetKeysFunc: func(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error) {
panic("mock out the GetKeys method")
},
GetSetMemberCountFunc: func(ctx context.Context, setKey string) (int64, error) {
panic("mock out the GetSetMemberCount method")
},
GetSetMemberValuesFunc: func(ctx context.Context, setKey string, matchPattern string, valuePrefix string, count int64, cursor uint64) (map[string]string, uint64, error) {
panic("mock out the GetSetMemberValues method")
},
GetTotalKeysFunc: func(ctx context.Context) (int64, error) {
panic("mock out the GetTotalKeys method")
},
GetValueFunc: func(ctx context.Context, key string) (string, error) {
panic("mock out the GetValue method")
},
SetAddFunc: func(ctx context.Context, key string, members ...interface{}) error {
panic("mock out the SetAdd method")
},
SetRemFunc: func(ctx context.Context, key string, members ...interface{}) error {
panic("mock out the SetRem method")
},
SetValueFunc: func(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
panic("mock out the SetValue method")
},
TransactionFunc: func(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error) {
panic("mock out the Transaction method")
},
}
// use mockedRedis in code that requires store.Redis
// and then make assertions.
}
func (*RedisMock) Checker ¶
func (mock *RedisMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*RedisMock) CheckerCalls ¶
func (mock *RedisMock) CheckerCalls() []struct { ContextMoqParam context.Context CheckState *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedRedis.CheckerCalls())
func (*RedisMock) DeleteValue ¶ added in v0.3.3
DeleteValue calls DeleteValueFunc.
func (*RedisMock) DeleteValueCalls ¶ added in v0.3.3
DeleteValueCalls gets all the calls that were made to DeleteValue. Check the length with:
len(mockedRedis.DeleteValueCalls())
func (*RedisMock) GetKeyValuePairs ¶ added in v0.3.5
func (mock *RedisMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
GetKeyValuePairs calls GetKeyValuePairsFunc.
func (*RedisMock) GetKeyValuePairsCalls ¶ added in v0.3.5
func (mock *RedisMock) GetKeyValuePairsCalls() []struct { Ctx context.Context MatchPattern string Count int64 Cursor uint64 }
GetKeyValuePairsCalls gets all the calls that were made to GetKeyValuePairs. Check the length with:
len(mockedRedis.GetKeyValuePairsCalls())
func (*RedisMock) GetKeys ¶ added in v1.4.0
func (mock *RedisMock) GetKeys(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error)
GetKeys calls GetKeysFunc.
func (*RedisMock) GetKeysCalls ¶ added in v1.4.0
func (mock *RedisMock) GetKeysCalls() []struct { Ctx context.Context MatchPattern string Count int64 Cursor uint64 }
GetKeysCalls gets all the calls that were made to GetKeys. Check the length with:
len(mockedRedis.GetKeysCalls())
func (*RedisMock) GetSetMemberCount ¶ added in v1.4.0
GetSetMemberCount calls GetSetMemberCountFunc.
func (*RedisMock) GetSetMemberCountCalls ¶ added in v1.4.0
GetSetMemberCountCalls gets all the calls that were made to GetSetMemberCount. Check the length with:
len(mockedRedis.GetSetMemberCountCalls())
func (*RedisMock) GetSetMemberValues ¶ added in v1.4.0
func (mock *RedisMock) GetSetMemberValues(ctx context.Context, setKey string, matchPattern string, valuePrefix string, count int64, cursor uint64) (map[string]string, uint64, error)
GetSetMemberValues calls GetSetMemberValuesFunc.
func (*RedisMock) GetSetMemberValuesCalls ¶ added in v1.4.0
func (mock *RedisMock) GetSetMemberValuesCalls() []struct { Ctx context.Context SetKey string MatchPattern string ValuePrefix string Count int64 Cursor uint64 }
GetSetMemberValuesCalls gets all the calls that were made to GetSetMemberValues. Check the length with:
len(mockedRedis.GetSetMemberValuesCalls())
func (*RedisMock) GetTotalKeys ¶ added in v0.3.5
GetTotalKeys calls GetTotalKeysFunc.
func (*RedisMock) GetTotalKeysCalls ¶ added in v0.3.5
GetTotalKeysCalls gets all the calls that were made to GetTotalKeys. Check the length with:
len(mockedRedis.GetTotalKeysCalls())
func (*RedisMock) GetValueCalls ¶
GetValueCalls gets all the calls that were made to GetValue. Check the length with:
len(mockedRedis.GetValueCalls())
func (*RedisMock) SetAddCalls ¶ added in v1.5.0
func (mock *RedisMock) SetAddCalls() []struct { Ctx context.Context Key string Members []interface{} }
SetAddCalls gets all the calls that were made to SetAdd. Check the length with:
len(mockedRedis.SetAddCalls())
func (*RedisMock) SetRemCalls ¶ added in v1.5.0
func (mock *RedisMock) SetRemCalls() []struct { Ctx context.Context Key string Members []interface{} }
SetRemCalls gets all the calls that were made to SetRem. Check the length with:
len(mockedRedis.SetRemCalls())
func (*RedisMock) SetValue ¶ added in v0.3.2
func (mock *RedisMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
SetValue calls SetValueFunc.
func (*RedisMock) SetValueCalls ¶ added in v0.3.2
func (mock *RedisMock) SetValueCalls() []struct { Ctx context.Context Key string Value interface{} Expiration time.Duration }
SetValueCalls gets all the calls that were made to SetValue. Check the length with:
len(mockedRedis.SetValueCalls())
type StorerMock ¶
type StorerMock struct {
// CheckerFunc mocks the Checker method.
CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error
// DeleteValueFunc mocks the DeleteValue method.
DeleteValueFunc func(ctx context.Context, key string) error
// GetKeyValuePairsFunc mocks the GetKeyValuePairs method.
GetKeyValuePairsFunc func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
// GetKeysFunc mocks the GetKeys method.
GetKeysFunc func(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error)
// GetSetMemberCountFunc mocks the GetSetMemberCount method.
GetSetMemberCountFunc func(ctx context.Context, setKey string) (int64, error)
// GetSetMemberValuesFunc mocks the GetSetMemberValues method.
GetSetMemberValuesFunc func(ctx context.Context, setKey string, matchPattern string, valuePrefix string, count int64, cursor uint64) (map[string]string, uint64, error)
// GetTotalKeysFunc mocks the GetTotalKeys method.
GetTotalKeysFunc func(ctx context.Context) (int64, error)
// GetValueFunc mocks the GetValue method.
GetValueFunc func(ctx context.Context, key string) (string, error)
// SetAddFunc mocks the SetAdd method.
SetAddFunc func(ctx context.Context, key string, members ...interface{}) error
// SetRemFunc mocks the SetRem method.
SetRemFunc func(ctx context.Context, key string, members ...interface{}) error
// SetValueFunc mocks the SetValue method.
SetValueFunc func(ctx context.Context, key string, value interface{}, expiration time.Duration) error
// TransactionFunc mocks the Transaction method.
TransactionFunc func(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error)
// contains filtered or unexported fields
}
StorerMock is a mock implementation of store.Storer.
func TestSomethingThatUsesStorer(t *testing.T) {
// make and configure a mocked store.Storer
mockedStorer := &StorerMock{
CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
DeleteValueFunc: func(ctx context.Context, key string) error {
panic("mock out the DeleteValue method")
},
GetKeyValuePairsFunc: func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error) {
panic("mock out the GetKeyValuePairs method")
},
GetKeysFunc: func(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error) {
panic("mock out the GetKeys method")
},
GetSetMemberCountFunc: func(ctx context.Context, setKey string) (int64, error) {
panic("mock out the GetSetMemberCount method")
},
GetSetMemberValuesFunc: func(ctx context.Context, setKey string, matchPattern string, valuePrefix string, count int64, cursor uint64) (map[string]string, uint64, error) {
panic("mock out the GetSetMemberValues method")
},
GetTotalKeysFunc: func(ctx context.Context) (int64, error) {
panic("mock out the GetTotalKeys method")
},
GetValueFunc: func(ctx context.Context, key string) (string, error) {
panic("mock out the GetValue method")
},
SetAddFunc: func(ctx context.Context, key string, members ...interface{}) error {
panic("mock out the SetAdd method")
},
SetRemFunc: func(ctx context.Context, key string, members ...interface{}) error {
panic("mock out the SetRem method")
},
SetValueFunc: func(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
panic("mock out the SetValue method")
},
TransactionFunc: func(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error) {
panic("mock out the Transaction method")
},
}
// use mockedStorer in code that requires store.Storer
// and then make assertions.
}
func (*StorerMock) Checker ¶
func (mock *StorerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*StorerMock) CheckerCalls ¶
func (mock *StorerMock) CheckerCalls() []struct { Ctx context.Context State *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedStorer.CheckerCalls())
func (*StorerMock) DeleteValue ¶ added in v0.3.3
func (mock *StorerMock) DeleteValue(ctx context.Context, key string) error
DeleteValue calls DeleteValueFunc.
func (*StorerMock) DeleteValueCalls ¶ added in v0.3.3
func (mock *StorerMock) DeleteValueCalls() []struct { Ctx context.Context Key string }
DeleteValueCalls gets all the calls that were made to DeleteValue. Check the length with:
len(mockedStorer.DeleteValueCalls())
func (*StorerMock) GetKeyValuePairs ¶ added in v0.3.5
func (mock *StorerMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
GetKeyValuePairs calls GetKeyValuePairsFunc.
func (*StorerMock) GetKeyValuePairsCalls ¶ added in v0.3.5
func (mock *StorerMock) GetKeyValuePairsCalls() []struct { Ctx context.Context MatchPattern string Count int64 Cursor uint64 }
GetKeyValuePairsCalls gets all the calls that were made to GetKeyValuePairs. Check the length with:
len(mockedStorer.GetKeyValuePairsCalls())
func (*StorerMock) GetKeys ¶ added in v1.4.0
func (mock *StorerMock) GetKeys(ctx context.Context, matchPattern string, count int64, cursor uint64) ([]string, uint64, error)
GetKeys calls GetKeysFunc.
func (*StorerMock) GetKeysCalls ¶ added in v1.4.0
func (mock *StorerMock) GetKeysCalls() []struct { Ctx context.Context MatchPattern string Count int64 Cursor uint64 }
GetKeysCalls gets all the calls that were made to GetKeys. Check the length with:
len(mockedStorer.GetKeysCalls())
func (*StorerMock) GetSetMemberCount ¶ added in v1.4.0
GetSetMemberCount calls GetSetMemberCountFunc.
func (*StorerMock) GetSetMemberCountCalls ¶ added in v1.4.0
func (mock *StorerMock) GetSetMemberCountCalls() []struct { Ctx context.Context SetKey string }
GetSetMemberCountCalls gets all the calls that were made to GetSetMemberCount. Check the length with:
len(mockedStorer.GetSetMemberCountCalls())
func (*StorerMock) GetSetMemberValues ¶ added in v1.4.0
func (mock *StorerMock) GetSetMemberValues(ctx context.Context, setKey string, matchPattern string, valuePrefix string, count int64, cursor uint64) (map[string]string, uint64, error)
GetSetMemberValues calls GetSetMemberValuesFunc.
func (*StorerMock) GetSetMemberValuesCalls ¶ added in v1.4.0
func (mock *StorerMock) GetSetMemberValuesCalls() []struct { Ctx context.Context SetKey string MatchPattern string ValuePrefix string Count int64 Cursor uint64 }
GetSetMemberValuesCalls gets all the calls that were made to GetSetMemberValues. Check the length with:
len(mockedStorer.GetSetMemberValuesCalls())
func (*StorerMock) GetTotalKeys ¶ added in v0.3.5
func (mock *StorerMock) GetTotalKeys(ctx context.Context) (int64, error)
GetTotalKeys calls GetTotalKeysFunc.
func (*StorerMock) GetTotalKeysCalls ¶ added in v0.3.5
func (mock *StorerMock) GetTotalKeysCalls() []struct { Ctx context.Context }
GetTotalKeysCalls gets all the calls that were made to GetTotalKeys. Check the length with:
len(mockedStorer.GetTotalKeysCalls())
func (*StorerMock) GetValueCalls ¶
func (mock *StorerMock) GetValueCalls() []struct { Ctx context.Context Key string }
GetValueCalls gets all the calls that were made to GetValue. Check the length with:
len(mockedStorer.GetValueCalls())
func (*StorerMock) SetAdd ¶ added in v1.5.0
func (mock *StorerMock) SetAdd(ctx context.Context, key string, members ...interface{}) error
SetAdd calls SetAddFunc.
func (*StorerMock) SetAddCalls ¶ added in v1.5.0
func (mock *StorerMock) SetAddCalls() []struct { Ctx context.Context Key string Members []interface{} }
SetAddCalls gets all the calls that were made to SetAdd. Check the length with:
len(mockedStorer.SetAddCalls())
func (*StorerMock) SetRem ¶ added in v1.5.0
func (mock *StorerMock) SetRem(ctx context.Context, key string, members ...interface{}) error
SetRem calls SetRemFunc.
func (*StorerMock) SetRemCalls ¶ added in v1.5.0
func (mock *StorerMock) SetRemCalls() []struct { Ctx context.Context Key string Members []interface{} }
SetRemCalls gets all the calls that were made to SetRem. Check the length with:
len(mockedStorer.SetRemCalls())
func (*StorerMock) SetValue ¶ added in v0.3.2
func (mock *StorerMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
SetValue calls SetValueFunc.
func (*StorerMock) SetValueCalls ¶ added in v0.3.2
func (mock *StorerMock) SetValueCalls() []struct { Ctx context.Context Key string Value interface{} Expiration time.Duration }
SetValueCalls gets all the calls that were made to SetValue. Check the length with:
len(mockedStorer.SetValueCalls())
func (*StorerMock) Transaction ¶ added in v1.4.0
func (mock *StorerMock) Transaction(ctx context.Context, queue func(redis.Pipeliner)) ([]redis.Cmder, error)
Transaction calls TransactionFunc.
func (*StorerMock) TransactionCalls ¶ added in v1.4.0
func (mock *StorerMock) TransactionCalls() []struct { Ctx context.Context Queue func(redis.Pipeliner) }
TransactionCalls gets all the calls that were made to Transaction. Check the length with:
len(mockedStorer.TransactionCalls())