Documentation ¶
Overview ¶
Package ormmocks contains generated mocks for orm types that can be used in testing. Right now, this package only contains a mock for ormtable.Hooks as this useful way for unit testing using an in-memory database. Rather than attempting to mock a whole table or database instance, instead a mock Hook instance can be passed in to verify that the expected insert/update/delete operations are happening in the database.
The Eq function gomock.Matcher that compares protobuf messages can be used in gomock EXPECT functions.
See TestHooks in ormdb/module_test.go for examples of how to use mock Hooks in a real-world scenario.
Package ormmocks is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MockHooks ¶
type MockHooks struct {
// contains filtered or unexported fields
}
MockHooks is a mock of Hooks interface.
func NewMockHooks ¶
func NewMockHooks(ctrl *gomock.Controller) *MockHooks
NewMockHooks creates a new mock instance.
func (*MockHooks) EXPECT ¶
func (m *MockHooks) EXPECT() *MockHooksMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockHooksMockRecorder ¶
type MockHooksMockRecorder struct {
// contains filtered or unexported fields
}
MockHooksMockRecorder is the mock recorder for MockHooks.
func (*MockHooksMockRecorder) OnDelete ¶
func (mr *MockHooksMockRecorder) OnDelete(arg0 interface{}) *gomock.Call
OnDelete indicates an expected call of OnDelete.
func (*MockHooksMockRecorder) OnInsert ¶
func (mr *MockHooksMockRecorder) OnInsert(arg0 interface{}) *gomock.Call
OnInsert indicates an expected call of OnInsert.
func (*MockHooksMockRecorder) OnUpdate ¶
func (mr *MockHooksMockRecorder) OnUpdate(existing, new interface{}) *gomock.Call
OnUpdate indicates an expected call of OnUpdate.