Documentation
¶
Index ¶
- type StoreMock
- func (mock *StoreMock) DeleteVersions(ctx context.Context, modelType string, modelID string, versions []int) (int, error)
- func (mock *StoreMock) DeleteVersionsCalls() []struct{ ... }
- func (mock *StoreMock) OverThreshold(ctx context.Context, threshold int, limit int) ([]auditlog.ModelRef, error)
- func (mock *StoreMock) OverThresholdCalls() []struct{ ... }
- func (mock *StoreMock) QueryHistoryByModelID(ctx context.Context, modelType string, modelID string) ([]auditlog.AuditLog, error)
- func (mock *StoreMock) QueryHistoryByModelIDCalls() []struct{ ... }
- func (mock *StoreMock) QueryLastByModelID(ctx context.Context, modelType string, modelID string) (auditlog.AuditLog, error)
- func (mock *StoreMock) QueryLastByModelIDCalls() []struct{ ... }
- func (mock *StoreMock) QueryModelByVersion(ctx context.Context, modelType string, modelID string, ver int) (auditlog.AuditLog, error)
- func (mock *StoreMock) QueryModelByVersionCalls() []struct{ ... }
- func (mock *StoreMock) Save(ctx context.Context, al auditlog.AuditLog) error
- func (mock *StoreMock) SaveCalls() []struct{ ... }
- func (mock *StoreMock) Versions(ctx context.Context, modelType string, modelID string) ([]int, error)
- func (mock *StoreMock) VersionsCalls() []struct{ ... }
- func (mock *StoreMock) WithTx(tx sqlx.ExtContext) auditlog.Store
- func (mock *StoreMock) WithTxCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StoreMock ¶
type StoreMock struct {
// DeleteVersionsFunc mocks the DeleteVersions method.
DeleteVersionsFunc func(ctx context.Context, modelType string, modelID string, versions []int) (int, error)
// OverThresholdFunc mocks the OverThreshold method.
OverThresholdFunc func(ctx context.Context, threshold int, limit int) ([]auditlog.ModelRef, error)
// QueryHistoryByModelIDFunc mocks the QueryHistoryByModelID method.
QueryHistoryByModelIDFunc func(ctx context.Context, modelType string, modelID string) ([]auditlog.AuditLog, error)
// QueryLastByModelIDFunc mocks the QueryLastByModelID method.
QueryLastByModelIDFunc func(ctx context.Context, modelType string, modelID string) (auditlog.AuditLog, error)
// QueryModelByVersionFunc mocks the QueryModelByVersion method.
QueryModelByVersionFunc func(ctx context.Context, modelType string, modelID string, ver int) (auditlog.AuditLog, error)
// SaveFunc mocks the Save method.
SaveFunc func(ctx context.Context, al auditlog.AuditLog) error
// VersionsFunc mocks the Versions method.
VersionsFunc func(ctx context.Context, modelType string, modelID string) ([]int, error)
// WithTxFunc mocks the WithTx method.
WithTxFunc func(tx sqlx.ExtContext) auditlog.Store
// contains filtered or unexported fields
}
StoreMock is a mock implementation of auditlog.Store.
func TestSomethingThatUsesStore(t *testing.T) {
// make and configure a mocked auditlog.Store
mockedStore := &StoreMock{
DeleteVersionsFunc: func(ctx context.Context, modelType string, modelID string, versions []int) (int, error) {
panic("mock out the DeleteVersions method")
},
OverThresholdFunc: func(ctx context.Context, threshold int, limit int) ([]auditlog.ModelRef, error) {
panic("mock out the OverThreshold method")
},
QueryHistoryByModelIDFunc: func(ctx context.Context, modelType string, modelID string) ([]auditlog.AuditLog, error) {
panic("mock out the QueryHistoryByModelID method")
},
QueryLastByModelIDFunc: func(ctx context.Context, modelType string, modelID string) (auditlog.AuditLog, error) {
panic("mock out the QueryLastByModelID method")
},
QueryModelByVersionFunc: func(ctx context.Context, modelType string, modelID string, ver int) (auditlog.AuditLog, error) {
panic("mock out the QueryModelByVersion method")
},
SaveFunc: func(ctx context.Context, al auditlog.AuditLog) error {
panic("mock out the Save method")
},
VersionsFunc: func(ctx context.Context, modelType string, modelID string) ([]int, error) {
panic("mock out the Versions method")
},
WithTxFunc: func(tx sqlx.ExtContext) auditlog.Store {
panic("mock out the WithTx method")
},
}
// use mockedStore in code that requires auditlog.Store
// and then make assertions.
}
func (*StoreMock) DeleteVersions ¶
func (mock *StoreMock) DeleteVersions(ctx context.Context, modelType string, modelID string, versions []int) (int, error)
DeleteVersions calls DeleteVersionsFunc.
func (*StoreMock) DeleteVersionsCalls ¶
func (mock *StoreMock) DeleteVersionsCalls() []struct { Ctx context.Context ModelType string ModelID string Versions []int }
DeleteVersionsCalls gets all the calls that were made to DeleteVersions. Check the length with:
len(mockedStore.DeleteVersionsCalls())
func (*StoreMock) OverThreshold ¶
func (mock *StoreMock) OverThreshold(ctx context.Context, threshold int, limit int) ([]auditlog.ModelRef, error)
OverThreshold calls OverThresholdFunc.
func (*StoreMock) OverThresholdCalls ¶
func (mock *StoreMock) OverThresholdCalls() []struct { Ctx context.Context Threshold int Limit int }
OverThresholdCalls gets all the calls that were made to OverThreshold. Check the length with:
len(mockedStore.OverThresholdCalls())
func (*StoreMock) QueryHistoryByModelID ¶
func (mock *StoreMock) QueryHistoryByModelID(ctx context.Context, modelType string, modelID string) ([]auditlog.AuditLog, error)
QueryHistoryByModelID calls QueryHistoryByModelIDFunc.
func (*StoreMock) QueryHistoryByModelIDCalls ¶
func (mock *StoreMock) QueryHistoryByModelIDCalls() []struct { Ctx context.Context ModelType string ModelID string }
QueryHistoryByModelIDCalls gets all the calls that were made to QueryHistoryByModelID. Check the length with:
len(mockedStore.QueryHistoryByModelIDCalls())
func (*StoreMock) QueryLastByModelID ¶
func (mock *StoreMock) QueryLastByModelID(ctx context.Context, modelType string, modelID string) (auditlog.AuditLog, error)
QueryLastByModelID calls QueryLastByModelIDFunc.
func (*StoreMock) QueryLastByModelIDCalls ¶
func (mock *StoreMock) QueryLastByModelIDCalls() []struct { Ctx context.Context ModelType string ModelID string }
QueryLastByModelIDCalls gets all the calls that were made to QueryLastByModelID. Check the length with:
len(mockedStore.QueryLastByModelIDCalls())
func (*StoreMock) QueryModelByVersion ¶
func (mock *StoreMock) QueryModelByVersion(ctx context.Context, modelType string, modelID string, ver int) (auditlog.AuditLog, error)
QueryModelByVersion calls QueryModelByVersionFunc.
func (*StoreMock) QueryModelByVersionCalls ¶
func (mock *StoreMock) QueryModelByVersionCalls() []struct { Ctx context.Context ModelType string ModelID string Ver int }
QueryModelByVersionCalls gets all the calls that were made to QueryModelByVersion. Check the length with:
len(mockedStore.QueryModelByVersionCalls())
func (*StoreMock) SaveCalls ¶
SaveCalls gets all the calls that were made to Save. Check the length with:
len(mockedStore.SaveCalls())
func (*StoreMock) Versions ¶
func (mock *StoreMock) Versions(ctx context.Context, modelType string, modelID string) ([]int, error)
Versions calls VersionsFunc.
func (*StoreMock) VersionsCalls ¶
func (mock *StoreMock) VersionsCalls() []struct { Ctx context.Context ModelType string ModelID string }
VersionsCalls gets all the calls that were made to Versions. Check the length with:
len(mockedStore.VersionsCalls())
func (*StoreMock) WithTx ¶
func (mock *StoreMock) WithTx(tx sqlx.ExtContext) auditlog.Store
WithTx calls WithTxFunc.
func (*StoreMock) WithTxCalls ¶
func (mock *StoreMock) WithTxCalls() []struct { Tx sqlx.ExtContext }
WithTxCalls gets all the calls that were made to WithTx. Check the length with:
len(mockedStore.WithTxCalls())