ormmocks

package
v1.0.0-alpha.10...-dcd69b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

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

func Eq

func Eq(message proto.Message) gomock.Matcher

Eq returns a gomock.Matcher which uses go-cmp to compare protobuf messages.

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.

func (*MockHooks) OnDelete

func (m *MockHooks) OnDelete(arg0 proto.Message) error

OnDelete mocks base method.

func (*MockHooks) OnInsert

func (m *MockHooks) OnInsert(arg0 proto.Message) error

OnInsert mocks base method.

func (*MockHooks) OnUpdate

func (m *MockHooks) OnUpdate(existing, new proto.Message) error

OnUpdate mocks base method.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL