package mocks

// Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.

//go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/interfaces.ThingTagRepository -o ./mocks/thing_tag_repository_minimock.go -n ThingTagRepositoryMock

import (
	"context"
	"database/sql"
	"sync"
	mm_atomic "sync/atomic"
	mm_time "time"

	"git.dmitriygnatenko.ru/dima/homethings/internal/models"
	"github.com/gojuno/minimock/v3"
)

// ThingTagRepositoryMock implements interfaces.ThingTagRepository
type ThingTagRepositoryMock struct {
	t minimock.Tester

	funcAdd          func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) (err error)
	inspectFuncAdd   func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx)
	afterAddCounter  uint64
	beforeAddCounter uint64
	AddMock          mThingTagRepositoryMockAdd

	funcBeginTx          func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)
	inspectFuncBeginTx   func(ctx context.Context, level sql.IsolationLevel)
	afterBeginTxCounter  uint64
	beforeBeginTxCounter uint64
	BeginTxMock          mThingTagRepositoryMockBeginTx

	funcCommitTx          func(tx *sql.Tx) (err error)
	inspectFuncCommitTx   func(tx *sql.Tx)
	afterCommitTxCounter  uint64
	beforeCommitTxCounter uint64
	CommitTxMock          mThingTagRepositoryMockCommitTx

	funcDelete          func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) (err error)
	inspectFuncDelete   func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx)
	afterDeleteCounter  uint64
	beforeDeleteCounter uint64
	DeleteMock          mThingTagRepositoryMockDelete

	funcDeleteByTagID          func(ctx context.Context, tagID int, tx *sql.Tx) (err error)
	inspectFuncDeleteByTagID   func(ctx context.Context, tagID int, tx *sql.Tx)
	afterDeleteByTagIDCounter  uint64
	beforeDeleteByTagIDCounter uint64
	DeleteByTagIDMock          mThingTagRepositoryMockDeleteByTagID

	funcDeleteByThingID          func(ctx context.Context, thingID int, tx *sql.Tx) (err error)
	inspectFuncDeleteByThingID   func(ctx context.Context, thingID int, tx *sql.Tx)
	afterDeleteByThingIDCounter  uint64
	beforeDeleteByThingIDCounter uint64
	DeleteByThingIDMock          mThingTagRepositoryMockDeleteByThingID

	funcGetByPlaceID          func(ctx context.Context, placeID int) (ta1 []models.ThingTag, err error)
	inspectFuncGetByPlaceID   func(ctx context.Context, placeID int)
	afterGetByPlaceIDCounter  uint64
	beforeGetByPlaceIDCounter uint64
	GetByPlaceIDMock          mThingTagRepositoryMockGetByPlaceID
}

// NewThingTagRepositoryMock returns a mock for interfaces.ThingTagRepository
func NewThingTagRepositoryMock(t minimock.Tester) *ThingTagRepositoryMock {
	m := &ThingTagRepositoryMock{t: t}
	if controller, ok := t.(minimock.MockController); ok {
		controller.RegisterMocker(m)
	}

	m.AddMock = mThingTagRepositoryMockAdd{mock: m}
	m.AddMock.callArgs = []*ThingTagRepositoryMockAddParams{}

	m.BeginTxMock = mThingTagRepositoryMockBeginTx{mock: m}
	m.BeginTxMock.callArgs = []*ThingTagRepositoryMockBeginTxParams{}

	m.CommitTxMock = mThingTagRepositoryMockCommitTx{mock: m}
	m.CommitTxMock.callArgs = []*ThingTagRepositoryMockCommitTxParams{}

	m.DeleteMock = mThingTagRepositoryMockDelete{mock: m}
	m.DeleteMock.callArgs = []*ThingTagRepositoryMockDeleteParams{}

	m.DeleteByTagIDMock = mThingTagRepositoryMockDeleteByTagID{mock: m}
	m.DeleteByTagIDMock.callArgs = []*ThingTagRepositoryMockDeleteByTagIDParams{}

	m.DeleteByThingIDMock = mThingTagRepositoryMockDeleteByThingID{mock: m}
	m.DeleteByThingIDMock.callArgs = []*ThingTagRepositoryMockDeleteByThingIDParams{}

	m.GetByPlaceIDMock = mThingTagRepositoryMockGetByPlaceID{mock: m}
	m.GetByPlaceIDMock.callArgs = []*ThingTagRepositoryMockGetByPlaceIDParams{}

	return m
}

type mThingTagRepositoryMockAdd struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockAddExpectation
	expectations       []*ThingTagRepositoryMockAddExpectation

	callArgs []*ThingTagRepositoryMockAddParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockAddExpectation specifies expectation struct of the ThingTagRepository.Add
type ThingTagRepositoryMockAddExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockAddParams
	results *ThingTagRepositoryMockAddResults
	Counter uint64
}

// ThingTagRepositoryMockAddParams contains parameters of the ThingTagRepository.Add
type ThingTagRepositoryMockAddParams struct {
	ctx context.Context
	req models.AddThingTagRequest
	tx  *sql.Tx
}

// ThingTagRepositoryMockAddResults contains results of the ThingTagRepository.Add
type ThingTagRepositoryMockAddResults struct {
	err error
}

// Expect sets up expected params for ThingTagRepository.Add
func (mmAdd *mThingTagRepositoryMockAdd) Expect(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) *mThingTagRepositoryMockAdd {
	if mmAdd.mock.funcAdd != nil {
		mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
	}

	if mmAdd.defaultExpectation == nil {
		mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{}
	}

	mmAdd.defaultExpectation.params = &ThingTagRepositoryMockAddParams{ctx, req, tx}
	for _, e := range mmAdd.expectations {
		if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
			mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
		}
	}

	return mmAdd
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.Add
func (mmAdd *mThingTagRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx)) *mThingTagRepositoryMockAdd {
	if mmAdd.mock.inspectFuncAdd != nil {
		mmAdd.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.Add")
	}

	mmAdd.mock.inspectFuncAdd = f

	return mmAdd
}

// Return sets up results that will be returned by ThingTagRepository.Add
func (mmAdd *mThingTagRepositoryMockAdd) Return(err error) *ThingTagRepositoryMock {
	if mmAdd.mock.funcAdd != nil {
		mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
	}

	if mmAdd.defaultExpectation == nil {
		mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{mock: mmAdd.mock}
	}
	mmAdd.defaultExpectation.results = &ThingTagRepositoryMockAddResults{err}
	return mmAdd.mock
}

// Set uses given function f to mock the ThingTagRepository.Add method
func (mmAdd *mThingTagRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
	if mmAdd.defaultExpectation != nil {
		mmAdd.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.Add method")
	}

	if len(mmAdd.expectations) > 0 {
		mmAdd.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.Add method")
	}

	mmAdd.mock.funcAdd = f
	return mmAdd.mock
}

// When sets expectation for the ThingTagRepository.Add which will trigger the result defined by the following
// Then helper
func (mmAdd *mThingTagRepositoryMockAdd) When(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) *ThingTagRepositoryMockAddExpectation {
	if mmAdd.mock.funcAdd != nil {
		mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockAddExpectation{
		mock:   mmAdd.mock,
		params: &ThingTagRepositoryMockAddParams{ctx, req, tx},
	}
	mmAdd.expectations = append(mmAdd.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.Add return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockAddExpectation) Then(err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockAddResults{err}
	return e.mock
}

// Add implements interfaces.ThingTagRepository
func (mmAdd *ThingTagRepositoryMock) Add(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
	defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)

	if mmAdd.inspectFuncAdd != nil {
		mmAdd.inspectFuncAdd(ctx, req, tx)
	}

	mm_params := &ThingTagRepositoryMockAddParams{ctx, req, tx}

	// Record call args
	mmAdd.AddMock.mutex.Lock()
	mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, mm_params)
	mmAdd.AddMock.mutex.Unlock()

	for _, e := range mmAdd.AddMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmAdd.AddMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
		mm_want := mmAdd.AddMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockAddParams{ctx, req, tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmAdd.t.Errorf("ThingTagRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmAdd.AddMock.defaultExpectation.results
		if mm_results == nil {
			mmAdd.t.Fatal("No results are set for the ThingTagRepositoryMock.Add")
		}
		return (*mm_results).err
	}
	if mmAdd.funcAdd != nil {
		return mmAdd.funcAdd(ctx, req, tx)
	}
	mmAdd.t.Fatalf("Unexpected call to ThingTagRepositoryMock.Add. %v %v %v", ctx, req, tx)
	return
}

// AddAfterCounter returns a count of finished ThingTagRepositoryMock.Add invocations
func (mmAdd *ThingTagRepositoryMock) AddAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
}

// AddBeforeCounter returns a count of ThingTagRepositoryMock.Add invocations
func (mmAdd *ThingTagRepositoryMock) AddBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.Add.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmAdd *mThingTagRepositoryMockAdd) Calls() []*ThingTagRepositoryMockAddParams {
	mmAdd.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockAddParams, len(mmAdd.callArgs))
	copy(argCopy, mmAdd.callArgs)

	mmAdd.mutex.RUnlock()

	return argCopy
}

// MinimockAddDone returns true if the count of the Add invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockAddDone() bool {
	for _, e := range m.AddMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		return false
	}
	return true
}

// MinimockAddInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockAddInspect() {
	for _, e := range m.AddMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.Add with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		if m.AddMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.Add")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.Add")
	}
}

type mThingTagRepositoryMockBeginTx struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockBeginTxExpectation
	expectations       []*ThingTagRepositoryMockBeginTxExpectation

	callArgs []*ThingTagRepositoryMockBeginTxParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockBeginTxExpectation specifies expectation struct of the ThingTagRepository.BeginTx
type ThingTagRepositoryMockBeginTxExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockBeginTxParams
	results *ThingTagRepositoryMockBeginTxResults
	Counter uint64
}

// ThingTagRepositoryMockBeginTxParams contains parameters of the ThingTagRepository.BeginTx
type ThingTagRepositoryMockBeginTxParams struct {
	ctx   context.Context
	level sql.IsolationLevel
}

// ThingTagRepositoryMockBeginTxResults contains results of the ThingTagRepository.BeginTx
type ThingTagRepositoryMockBeginTxResults struct {
	tp1 *sql.Tx
	err error
}

// Expect sets up expected params for ThingTagRepository.BeginTx
func (mmBeginTx *mThingTagRepositoryMockBeginTx) Expect(ctx context.Context, level sql.IsolationLevel) *mThingTagRepositoryMockBeginTx {
	if mmBeginTx.mock.funcBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("ThingTagRepositoryMock.BeginTx mock is already set by Set")
	}

	if mmBeginTx.defaultExpectation == nil {
		mmBeginTx.defaultExpectation = &ThingTagRepositoryMockBeginTxExpectation{}
	}

	mmBeginTx.defaultExpectation.params = &ThingTagRepositoryMockBeginTxParams{ctx, level}
	for _, e := range mmBeginTx.expectations {
		if minimock.Equal(e.params, mmBeginTx.defaultExpectation.params) {
			mmBeginTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmBeginTx.defaultExpectation.params)
		}
	}

	return mmBeginTx
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.BeginTx
func (mmBeginTx *mThingTagRepositoryMockBeginTx) Inspect(f func(ctx context.Context, level sql.IsolationLevel)) *mThingTagRepositoryMockBeginTx {
	if mmBeginTx.mock.inspectFuncBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.BeginTx")
	}

	mmBeginTx.mock.inspectFuncBeginTx = f

	return mmBeginTx
}

// Return sets up results that will be returned by ThingTagRepository.BeginTx
func (mmBeginTx *mThingTagRepositoryMockBeginTx) Return(tp1 *sql.Tx, err error) *ThingTagRepositoryMock {
	if mmBeginTx.mock.funcBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("ThingTagRepositoryMock.BeginTx mock is already set by Set")
	}

	if mmBeginTx.defaultExpectation == nil {
		mmBeginTx.defaultExpectation = &ThingTagRepositoryMockBeginTxExpectation{mock: mmBeginTx.mock}
	}
	mmBeginTx.defaultExpectation.results = &ThingTagRepositoryMockBeginTxResults{tp1, err}
	return mmBeginTx.mock
}

// Set uses given function f to mock the ThingTagRepository.BeginTx method
func (mmBeginTx *mThingTagRepositoryMockBeginTx) Set(f func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)) *ThingTagRepositoryMock {
	if mmBeginTx.defaultExpectation != nil {
		mmBeginTx.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.BeginTx method")
	}

	if len(mmBeginTx.expectations) > 0 {
		mmBeginTx.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.BeginTx method")
	}

	mmBeginTx.mock.funcBeginTx = f
	return mmBeginTx.mock
}

// When sets expectation for the ThingTagRepository.BeginTx which will trigger the result defined by the following
// Then helper
func (mmBeginTx *mThingTagRepositoryMockBeginTx) When(ctx context.Context, level sql.IsolationLevel) *ThingTagRepositoryMockBeginTxExpectation {
	if mmBeginTx.mock.funcBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("ThingTagRepositoryMock.BeginTx mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockBeginTxExpectation{
		mock:   mmBeginTx.mock,
		params: &ThingTagRepositoryMockBeginTxParams{ctx, level},
	}
	mmBeginTx.expectations = append(mmBeginTx.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.BeginTx return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockBeginTxExpectation) Then(tp1 *sql.Tx, err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockBeginTxResults{tp1, err}
	return e.mock
}

// BeginTx implements interfaces.ThingTagRepository
func (mmBeginTx *ThingTagRepositoryMock) BeginTx(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error) {
	mm_atomic.AddUint64(&mmBeginTx.beforeBeginTxCounter, 1)
	defer mm_atomic.AddUint64(&mmBeginTx.afterBeginTxCounter, 1)

	if mmBeginTx.inspectFuncBeginTx != nil {
		mmBeginTx.inspectFuncBeginTx(ctx, level)
	}

	mm_params := &ThingTagRepositoryMockBeginTxParams{ctx, level}

	// Record call args
	mmBeginTx.BeginTxMock.mutex.Lock()
	mmBeginTx.BeginTxMock.callArgs = append(mmBeginTx.BeginTxMock.callArgs, mm_params)
	mmBeginTx.BeginTxMock.mutex.Unlock()

	for _, e := range mmBeginTx.BeginTxMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.tp1, e.results.err
		}
	}

	if mmBeginTx.BeginTxMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmBeginTx.BeginTxMock.defaultExpectation.Counter, 1)
		mm_want := mmBeginTx.BeginTxMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockBeginTxParams{ctx, level}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmBeginTx.t.Errorf("ThingTagRepositoryMock.BeginTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmBeginTx.BeginTxMock.defaultExpectation.results
		if mm_results == nil {
			mmBeginTx.t.Fatal("No results are set for the ThingTagRepositoryMock.BeginTx")
		}
		return (*mm_results).tp1, (*mm_results).err
	}
	if mmBeginTx.funcBeginTx != nil {
		return mmBeginTx.funcBeginTx(ctx, level)
	}
	mmBeginTx.t.Fatalf("Unexpected call to ThingTagRepositoryMock.BeginTx. %v %v", ctx, level)
	return
}

// BeginTxAfterCounter returns a count of finished ThingTagRepositoryMock.BeginTx invocations
func (mmBeginTx *ThingTagRepositoryMock) BeginTxAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmBeginTx.afterBeginTxCounter)
}

// BeginTxBeforeCounter returns a count of ThingTagRepositoryMock.BeginTx invocations
func (mmBeginTx *ThingTagRepositoryMock) BeginTxBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmBeginTx.beforeBeginTxCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.BeginTx.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmBeginTx *mThingTagRepositoryMockBeginTx) Calls() []*ThingTagRepositoryMockBeginTxParams {
	mmBeginTx.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockBeginTxParams, len(mmBeginTx.callArgs))
	copy(argCopy, mmBeginTx.callArgs)

	mmBeginTx.mutex.RUnlock()

	return argCopy
}

// MinimockBeginTxDone returns true if the count of the BeginTx invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockBeginTxDone() bool {
	for _, e := range m.BeginTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.BeginTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcBeginTx != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		return false
	}
	return true
}

// MinimockBeginTxInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockBeginTxInspect() {
	for _, e := range m.BeginTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.BeginTx with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.BeginTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		if m.BeginTxMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.BeginTx")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.BeginTx with params: %#v", *m.BeginTxMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcBeginTx != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.BeginTx")
	}
}

type mThingTagRepositoryMockCommitTx struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockCommitTxExpectation
	expectations       []*ThingTagRepositoryMockCommitTxExpectation

	callArgs []*ThingTagRepositoryMockCommitTxParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockCommitTxExpectation specifies expectation struct of the ThingTagRepository.CommitTx
type ThingTagRepositoryMockCommitTxExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockCommitTxParams
	results *ThingTagRepositoryMockCommitTxResults
	Counter uint64
}

// ThingTagRepositoryMockCommitTxParams contains parameters of the ThingTagRepository.CommitTx
type ThingTagRepositoryMockCommitTxParams struct {
	tx *sql.Tx
}

// ThingTagRepositoryMockCommitTxResults contains results of the ThingTagRepository.CommitTx
type ThingTagRepositoryMockCommitTxResults struct {
	err error
}

// Expect sets up expected params for ThingTagRepository.CommitTx
func (mmCommitTx *mThingTagRepositoryMockCommitTx) Expect(tx *sql.Tx) *mThingTagRepositoryMockCommitTx {
	if mmCommitTx.mock.funcCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("ThingTagRepositoryMock.CommitTx mock is already set by Set")
	}

	if mmCommitTx.defaultExpectation == nil {
		mmCommitTx.defaultExpectation = &ThingTagRepositoryMockCommitTxExpectation{}
	}

	mmCommitTx.defaultExpectation.params = &ThingTagRepositoryMockCommitTxParams{tx}
	for _, e := range mmCommitTx.expectations {
		if minimock.Equal(e.params, mmCommitTx.defaultExpectation.params) {
			mmCommitTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCommitTx.defaultExpectation.params)
		}
	}

	return mmCommitTx
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.CommitTx
func (mmCommitTx *mThingTagRepositoryMockCommitTx) Inspect(f func(tx *sql.Tx)) *mThingTagRepositoryMockCommitTx {
	if mmCommitTx.mock.inspectFuncCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.CommitTx")
	}

	mmCommitTx.mock.inspectFuncCommitTx = f

	return mmCommitTx
}

// Return sets up results that will be returned by ThingTagRepository.CommitTx
func (mmCommitTx *mThingTagRepositoryMockCommitTx) Return(err error) *ThingTagRepositoryMock {
	if mmCommitTx.mock.funcCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("ThingTagRepositoryMock.CommitTx mock is already set by Set")
	}

	if mmCommitTx.defaultExpectation == nil {
		mmCommitTx.defaultExpectation = &ThingTagRepositoryMockCommitTxExpectation{mock: mmCommitTx.mock}
	}
	mmCommitTx.defaultExpectation.results = &ThingTagRepositoryMockCommitTxResults{err}
	return mmCommitTx.mock
}

// Set uses given function f to mock the ThingTagRepository.CommitTx method
func (mmCommitTx *mThingTagRepositoryMockCommitTx) Set(f func(tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
	if mmCommitTx.defaultExpectation != nil {
		mmCommitTx.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.CommitTx method")
	}

	if len(mmCommitTx.expectations) > 0 {
		mmCommitTx.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.CommitTx method")
	}

	mmCommitTx.mock.funcCommitTx = f
	return mmCommitTx.mock
}

// When sets expectation for the ThingTagRepository.CommitTx which will trigger the result defined by the following
// Then helper
func (mmCommitTx *mThingTagRepositoryMockCommitTx) When(tx *sql.Tx) *ThingTagRepositoryMockCommitTxExpectation {
	if mmCommitTx.mock.funcCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("ThingTagRepositoryMock.CommitTx mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockCommitTxExpectation{
		mock:   mmCommitTx.mock,
		params: &ThingTagRepositoryMockCommitTxParams{tx},
	}
	mmCommitTx.expectations = append(mmCommitTx.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.CommitTx return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockCommitTxExpectation) Then(err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockCommitTxResults{err}
	return e.mock
}

// CommitTx implements interfaces.ThingTagRepository
func (mmCommitTx *ThingTagRepositoryMock) CommitTx(tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmCommitTx.beforeCommitTxCounter, 1)
	defer mm_atomic.AddUint64(&mmCommitTx.afterCommitTxCounter, 1)

	if mmCommitTx.inspectFuncCommitTx != nil {
		mmCommitTx.inspectFuncCommitTx(tx)
	}

	mm_params := &ThingTagRepositoryMockCommitTxParams{tx}

	// Record call args
	mmCommitTx.CommitTxMock.mutex.Lock()
	mmCommitTx.CommitTxMock.callArgs = append(mmCommitTx.CommitTxMock.callArgs, mm_params)
	mmCommitTx.CommitTxMock.mutex.Unlock()

	for _, e := range mmCommitTx.CommitTxMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmCommitTx.CommitTxMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmCommitTx.CommitTxMock.defaultExpectation.Counter, 1)
		mm_want := mmCommitTx.CommitTxMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockCommitTxParams{tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmCommitTx.t.Errorf("ThingTagRepositoryMock.CommitTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmCommitTx.CommitTxMock.defaultExpectation.results
		if mm_results == nil {
			mmCommitTx.t.Fatal("No results are set for the ThingTagRepositoryMock.CommitTx")
		}
		return (*mm_results).err
	}
	if mmCommitTx.funcCommitTx != nil {
		return mmCommitTx.funcCommitTx(tx)
	}
	mmCommitTx.t.Fatalf("Unexpected call to ThingTagRepositoryMock.CommitTx. %v", tx)
	return
}

// CommitTxAfterCounter returns a count of finished ThingTagRepositoryMock.CommitTx invocations
func (mmCommitTx *ThingTagRepositoryMock) CommitTxAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmCommitTx.afterCommitTxCounter)
}

// CommitTxBeforeCounter returns a count of ThingTagRepositoryMock.CommitTx invocations
func (mmCommitTx *ThingTagRepositoryMock) CommitTxBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmCommitTx.beforeCommitTxCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.CommitTx.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmCommitTx *mThingTagRepositoryMockCommitTx) Calls() []*ThingTagRepositoryMockCommitTxParams {
	mmCommitTx.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockCommitTxParams, len(mmCommitTx.callArgs))
	copy(argCopy, mmCommitTx.callArgs)

	mmCommitTx.mutex.RUnlock()

	return argCopy
}

// MinimockCommitTxDone returns true if the count of the CommitTx invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockCommitTxDone() bool {
	for _, e := range m.CommitTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.CommitTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcCommitTx != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		return false
	}
	return true
}

// MinimockCommitTxInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockCommitTxInspect() {
	for _, e := range m.CommitTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.CommitTx with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.CommitTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		if m.CommitTxMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.CommitTx")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.CommitTx with params: %#v", *m.CommitTxMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcCommitTx != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.CommitTx")
	}
}

type mThingTagRepositoryMockDelete struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockDeleteExpectation
	expectations       []*ThingTagRepositoryMockDeleteExpectation

	callArgs []*ThingTagRepositoryMockDeleteParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockDeleteExpectation specifies expectation struct of the ThingTagRepository.Delete
type ThingTagRepositoryMockDeleteExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockDeleteParams
	results *ThingTagRepositoryMockDeleteResults
	Counter uint64
}

// ThingTagRepositoryMockDeleteParams contains parameters of the ThingTagRepository.Delete
type ThingTagRepositoryMockDeleteParams struct {
	ctx context.Context
	req models.DeleteThingTagRequest
	tx  *sql.Tx
}

// ThingTagRepositoryMockDeleteResults contains results of the ThingTagRepository.Delete
type ThingTagRepositoryMockDeleteResults struct {
	err error
}

// Expect sets up expected params for ThingTagRepository.Delete
func (mmDelete *mThingTagRepositoryMockDelete) Expect(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) *mThingTagRepositoryMockDelete {
	if mmDelete.mock.funcDelete != nil {
		mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
	}

	if mmDelete.defaultExpectation == nil {
		mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{}
	}

	mmDelete.defaultExpectation.params = &ThingTagRepositoryMockDeleteParams{ctx, req, tx}
	for _, e := range mmDelete.expectations {
		if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
			mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
		}
	}

	return mmDelete
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.Delete
func (mmDelete *mThingTagRepositoryMockDelete) Inspect(f func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx)) *mThingTagRepositoryMockDelete {
	if mmDelete.mock.inspectFuncDelete != nil {
		mmDelete.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.Delete")
	}

	mmDelete.mock.inspectFuncDelete = f

	return mmDelete
}

// Return sets up results that will be returned by ThingTagRepository.Delete
func (mmDelete *mThingTagRepositoryMockDelete) Return(err error) *ThingTagRepositoryMock {
	if mmDelete.mock.funcDelete != nil {
		mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
	}

	if mmDelete.defaultExpectation == nil {
		mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{mock: mmDelete.mock}
	}
	mmDelete.defaultExpectation.results = &ThingTagRepositoryMockDeleteResults{err}
	return mmDelete.mock
}

// Set uses given function f to mock the ThingTagRepository.Delete method
func (mmDelete *mThingTagRepositoryMockDelete) Set(f func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
	if mmDelete.defaultExpectation != nil {
		mmDelete.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.Delete method")
	}

	if len(mmDelete.expectations) > 0 {
		mmDelete.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.Delete method")
	}

	mmDelete.mock.funcDelete = f
	return mmDelete.mock
}

// When sets expectation for the ThingTagRepository.Delete which will trigger the result defined by the following
// Then helper
func (mmDelete *mThingTagRepositoryMockDelete) When(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) *ThingTagRepositoryMockDeleteExpectation {
	if mmDelete.mock.funcDelete != nil {
		mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockDeleteExpectation{
		mock:   mmDelete.mock,
		params: &ThingTagRepositoryMockDeleteParams{ctx, req, tx},
	}
	mmDelete.expectations = append(mmDelete.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.Delete return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockDeleteExpectation) Then(err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockDeleteResults{err}
	return e.mock
}

// Delete implements interfaces.ThingTagRepository
func (mmDelete *ThingTagRepositoryMock) Delete(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
	defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)

	if mmDelete.inspectFuncDelete != nil {
		mmDelete.inspectFuncDelete(ctx, req, tx)
	}

	mm_params := &ThingTagRepositoryMockDeleteParams{ctx, req, tx}

	// Record call args
	mmDelete.DeleteMock.mutex.Lock()
	mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, mm_params)
	mmDelete.DeleteMock.mutex.Unlock()

	for _, e := range mmDelete.DeleteMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmDelete.DeleteMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
		mm_want := mmDelete.DeleteMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockDeleteParams{ctx, req, tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmDelete.t.Errorf("ThingTagRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmDelete.DeleteMock.defaultExpectation.results
		if mm_results == nil {
			mmDelete.t.Fatal("No results are set for the ThingTagRepositoryMock.Delete")
		}
		return (*mm_results).err
	}
	if mmDelete.funcDelete != nil {
		return mmDelete.funcDelete(ctx, req, tx)
	}
	mmDelete.t.Fatalf("Unexpected call to ThingTagRepositoryMock.Delete. %v %v %v", ctx, req, tx)
	return
}

// DeleteAfterCounter returns a count of finished ThingTagRepositoryMock.Delete invocations
func (mmDelete *ThingTagRepositoryMock) DeleteAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
}

// DeleteBeforeCounter returns a count of ThingTagRepositoryMock.Delete invocations
func (mmDelete *ThingTagRepositoryMock) DeleteBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.Delete.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmDelete *mThingTagRepositoryMockDelete) Calls() []*ThingTagRepositoryMockDeleteParams {
	mmDelete.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockDeleteParams, len(mmDelete.callArgs))
	copy(argCopy, mmDelete.callArgs)

	mmDelete.mutex.RUnlock()

	return argCopy
}

// MinimockDeleteDone returns true if the count of the Delete invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockDeleteDone() bool {
	for _, e := range m.DeleteMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		return false
	}
	return true
}

// MinimockDeleteInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockDeleteInspect() {
	for _, e := range m.DeleteMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.Delete with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		if m.DeleteMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.Delete")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.Delete")
	}
}

type mThingTagRepositoryMockDeleteByTagID struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockDeleteByTagIDExpectation
	expectations       []*ThingTagRepositoryMockDeleteByTagIDExpectation

	callArgs []*ThingTagRepositoryMockDeleteByTagIDParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockDeleteByTagIDExpectation specifies expectation struct of the ThingTagRepository.DeleteByTagID
type ThingTagRepositoryMockDeleteByTagIDExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockDeleteByTagIDParams
	results *ThingTagRepositoryMockDeleteByTagIDResults
	Counter uint64
}

// ThingTagRepositoryMockDeleteByTagIDParams contains parameters of the ThingTagRepository.DeleteByTagID
type ThingTagRepositoryMockDeleteByTagIDParams struct {
	ctx   context.Context
	tagID int
	tx    *sql.Tx
}

// ThingTagRepositoryMockDeleteByTagIDResults contains results of the ThingTagRepository.DeleteByTagID
type ThingTagRepositoryMockDeleteByTagIDResults struct {
	err error
}

// Expect sets up expected params for ThingTagRepository.DeleteByTagID
func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Expect(ctx context.Context, tagID int, tx *sql.Tx) *mThingTagRepositoryMockDeleteByTagID {
	if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
		mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
	}

	if mmDeleteByTagID.defaultExpectation == nil {
		mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{}
	}

	mmDeleteByTagID.defaultExpectation.params = &ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx}
	for _, e := range mmDeleteByTagID.expectations {
		if minimock.Equal(e.params, mmDeleteByTagID.defaultExpectation.params) {
			mmDeleteByTagID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteByTagID.defaultExpectation.params)
		}
	}

	return mmDeleteByTagID
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.DeleteByTagID
func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Inspect(f func(ctx context.Context, tagID int, tx *sql.Tx)) *mThingTagRepositoryMockDeleteByTagID {
	if mmDeleteByTagID.mock.inspectFuncDeleteByTagID != nil {
		mmDeleteByTagID.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.DeleteByTagID")
	}

	mmDeleteByTagID.mock.inspectFuncDeleteByTagID = f

	return mmDeleteByTagID
}

// Return sets up results that will be returned by ThingTagRepository.DeleteByTagID
func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Return(err error) *ThingTagRepositoryMock {
	if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
		mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
	}

	if mmDeleteByTagID.defaultExpectation == nil {
		mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{mock: mmDeleteByTagID.mock}
	}
	mmDeleteByTagID.defaultExpectation.results = &ThingTagRepositoryMockDeleteByTagIDResults{err}
	return mmDeleteByTagID.mock
}

// Set uses given function f to mock the ThingTagRepository.DeleteByTagID method
func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Set(f func(ctx context.Context, tagID int, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
	if mmDeleteByTagID.defaultExpectation != nil {
		mmDeleteByTagID.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.DeleteByTagID method")
	}

	if len(mmDeleteByTagID.expectations) > 0 {
		mmDeleteByTagID.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.DeleteByTagID method")
	}

	mmDeleteByTagID.mock.funcDeleteByTagID = f
	return mmDeleteByTagID.mock
}

// When sets expectation for the ThingTagRepository.DeleteByTagID which will trigger the result defined by the following
// Then helper
func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) When(ctx context.Context, tagID int, tx *sql.Tx) *ThingTagRepositoryMockDeleteByTagIDExpectation {
	if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
		mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockDeleteByTagIDExpectation{
		mock:   mmDeleteByTagID.mock,
		params: &ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx},
	}
	mmDeleteByTagID.expectations = append(mmDeleteByTagID.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.DeleteByTagID return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockDeleteByTagIDExpectation) Then(err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockDeleteByTagIDResults{err}
	return e.mock
}

// DeleteByTagID implements interfaces.ThingTagRepository
func (mmDeleteByTagID *ThingTagRepositoryMock) DeleteByTagID(ctx context.Context, tagID int, tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmDeleteByTagID.beforeDeleteByTagIDCounter, 1)
	defer mm_atomic.AddUint64(&mmDeleteByTagID.afterDeleteByTagIDCounter, 1)

	if mmDeleteByTagID.inspectFuncDeleteByTagID != nil {
		mmDeleteByTagID.inspectFuncDeleteByTagID(ctx, tagID, tx)
	}

	mm_params := &ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx}

	// Record call args
	mmDeleteByTagID.DeleteByTagIDMock.mutex.Lock()
	mmDeleteByTagID.DeleteByTagIDMock.callArgs = append(mmDeleteByTagID.DeleteByTagIDMock.callArgs, mm_params)
	mmDeleteByTagID.DeleteByTagIDMock.mutex.Unlock()

	for _, e := range mmDeleteByTagID.DeleteByTagIDMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.Counter, 1)
		mm_want := mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmDeleteByTagID.t.Errorf("ThingTagRepositoryMock.DeleteByTagID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.results
		if mm_results == nil {
			mmDeleteByTagID.t.Fatal("No results are set for the ThingTagRepositoryMock.DeleteByTagID")
		}
		return (*mm_results).err
	}
	if mmDeleteByTagID.funcDeleteByTagID != nil {
		return mmDeleteByTagID.funcDeleteByTagID(ctx, tagID, tx)
	}
	mmDeleteByTagID.t.Fatalf("Unexpected call to ThingTagRepositoryMock.DeleteByTagID. %v %v %v", ctx, tagID, tx)
	return
}

// DeleteByTagIDAfterCounter returns a count of finished ThingTagRepositoryMock.DeleteByTagID invocations
func (mmDeleteByTagID *ThingTagRepositoryMock) DeleteByTagIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDeleteByTagID.afterDeleteByTagIDCounter)
}

// DeleteByTagIDBeforeCounter returns a count of ThingTagRepositoryMock.DeleteByTagID invocations
func (mmDeleteByTagID *ThingTagRepositoryMock) DeleteByTagIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDeleteByTagID.beforeDeleteByTagIDCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.DeleteByTagID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Calls() []*ThingTagRepositoryMockDeleteByTagIDParams {
	mmDeleteByTagID.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockDeleteByTagIDParams, len(mmDeleteByTagID.callArgs))
	copy(argCopy, mmDeleteByTagID.callArgs)

	mmDeleteByTagID.mutex.RUnlock()

	return argCopy
}

// MinimockDeleteByTagIDDone returns true if the count of the DeleteByTagID invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockDeleteByTagIDDone() bool {
	for _, e := range m.DeleteByTagIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteByTagIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteByTagIDCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDeleteByTagID != nil && mm_atomic.LoadUint64(&m.afterDeleteByTagIDCounter) < 1 {
		return false
	}
	return true
}

// MinimockDeleteByTagIDInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockDeleteByTagIDInspect() {
	for _, e := range m.DeleteByTagIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.DeleteByTagID with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteByTagIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteByTagIDCounter) < 1 {
		if m.DeleteByTagIDMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.DeleteByTagID")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.DeleteByTagID with params: %#v", *m.DeleteByTagIDMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDeleteByTagID != nil && mm_atomic.LoadUint64(&m.afterDeleteByTagIDCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.DeleteByTagID")
	}
}

type mThingTagRepositoryMockDeleteByThingID struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockDeleteByThingIDExpectation
	expectations       []*ThingTagRepositoryMockDeleteByThingIDExpectation

	callArgs []*ThingTagRepositoryMockDeleteByThingIDParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockDeleteByThingIDExpectation specifies expectation struct of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockDeleteByThingIDParams
	results *ThingTagRepositoryMockDeleteByThingIDResults
	Counter uint64
}

// ThingTagRepositoryMockDeleteByThingIDParams contains parameters of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDParams struct {
	ctx     context.Context
	thingID int
	tx      *sql.Tx
}

// ThingTagRepositoryMockDeleteByThingIDResults contains results of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDResults struct {
	err error
}

// Expect sets up expected params for ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Expect(ctx context.Context, thingID int, tx *sql.Tx) *mThingTagRepositoryMockDeleteByThingID {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	if mmDeleteByThingID.defaultExpectation == nil {
		mmDeleteByThingID.defaultExpectation = &ThingTagRepositoryMockDeleteByThingIDExpectation{}
	}

	mmDeleteByThingID.defaultExpectation.params = &ThingTagRepositoryMockDeleteByThingIDParams{ctx, thingID, tx}
	for _, e := range mmDeleteByThingID.expectations {
		if minimock.Equal(e.params, mmDeleteByThingID.defaultExpectation.params) {
			mmDeleteByThingID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteByThingID.defaultExpectation.params)
		}
	}

	return mmDeleteByThingID
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Inspect(f func(ctx context.Context, thingID int, tx *sql.Tx)) *mThingTagRepositoryMockDeleteByThingID {
	if mmDeleteByThingID.mock.inspectFuncDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.DeleteByThingID")
	}

	mmDeleteByThingID.mock.inspectFuncDeleteByThingID = f

	return mmDeleteByThingID
}

// Return sets up results that will be returned by ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Return(err error) *ThingTagRepositoryMock {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	if mmDeleteByThingID.defaultExpectation == nil {
		mmDeleteByThingID.defaultExpectation = &ThingTagRepositoryMockDeleteByThingIDExpectation{mock: mmDeleteByThingID.mock}
	}
	mmDeleteByThingID.defaultExpectation.results = &ThingTagRepositoryMockDeleteByThingIDResults{err}
	return mmDeleteByThingID.mock
}

// Set uses given function f to mock the ThingTagRepository.DeleteByThingID method
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Set(f func(ctx context.Context, thingID int, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
	if mmDeleteByThingID.defaultExpectation != nil {
		mmDeleteByThingID.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.DeleteByThingID method")
	}

	if len(mmDeleteByThingID.expectations) > 0 {
		mmDeleteByThingID.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.DeleteByThingID method")
	}

	mmDeleteByThingID.mock.funcDeleteByThingID = f
	return mmDeleteByThingID.mock
}

// When sets expectation for the ThingTagRepository.DeleteByThingID which will trigger the result defined by the following
// Then helper
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) When(ctx context.Context, thingID int, tx *sql.Tx) *ThingTagRepositoryMockDeleteByThingIDExpectation {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockDeleteByThingIDExpectation{
		mock:   mmDeleteByThingID.mock,
		params: &ThingTagRepositoryMockDeleteByThingIDParams{ctx, thingID, tx},
	}
	mmDeleteByThingID.expectations = append(mmDeleteByThingID.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.DeleteByThingID return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockDeleteByThingIDExpectation) Then(err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockDeleteByThingIDResults{err}
	return e.mock
}

// DeleteByThingID implements interfaces.ThingTagRepository
func (mmDeleteByThingID *ThingTagRepositoryMock) DeleteByThingID(ctx context.Context, thingID int, tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmDeleteByThingID.beforeDeleteByThingIDCounter, 1)
	defer mm_atomic.AddUint64(&mmDeleteByThingID.afterDeleteByThingIDCounter, 1)

	if mmDeleteByThingID.inspectFuncDeleteByThingID != nil {
		mmDeleteByThingID.inspectFuncDeleteByThingID(ctx, thingID, tx)
	}

	mm_params := &ThingTagRepositoryMockDeleteByThingIDParams{ctx, thingID, tx}

	// Record call args
	mmDeleteByThingID.DeleteByThingIDMock.mutex.Lock()
	mmDeleteByThingID.DeleteByThingIDMock.callArgs = append(mmDeleteByThingID.DeleteByThingIDMock.callArgs, mm_params)
	mmDeleteByThingID.DeleteByThingIDMock.mutex.Unlock()

	for _, e := range mmDeleteByThingID.DeleteByThingIDMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.Counter, 1)
		mm_want := mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockDeleteByThingIDParams{ctx, thingID, tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmDeleteByThingID.t.Errorf("ThingTagRepositoryMock.DeleteByThingID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.results
		if mm_results == nil {
			mmDeleteByThingID.t.Fatal("No results are set for the ThingTagRepositoryMock.DeleteByThingID")
		}
		return (*mm_results).err
	}
	if mmDeleteByThingID.funcDeleteByThingID != nil {
		return mmDeleteByThingID.funcDeleteByThingID(ctx, thingID, tx)
	}
	mmDeleteByThingID.t.Fatalf("Unexpected call to ThingTagRepositoryMock.DeleteByThingID. %v %v %v", ctx, thingID, tx)
	return
}

// DeleteByThingIDAfterCounter returns a count of finished ThingTagRepositoryMock.DeleteByThingID invocations
func (mmDeleteByThingID *ThingTagRepositoryMock) DeleteByThingIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDeleteByThingID.afterDeleteByThingIDCounter)
}

// DeleteByThingIDBeforeCounter returns a count of ThingTagRepositoryMock.DeleteByThingID invocations
func (mmDeleteByThingID *ThingTagRepositoryMock) DeleteByThingIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDeleteByThingID.beforeDeleteByThingIDCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.DeleteByThingID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Calls() []*ThingTagRepositoryMockDeleteByThingIDParams {
	mmDeleteByThingID.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockDeleteByThingIDParams, len(mmDeleteByThingID.callArgs))
	copy(argCopy, mmDeleteByThingID.callArgs)

	mmDeleteByThingID.mutex.RUnlock()

	return argCopy
}

// MinimockDeleteByThingIDDone returns true if the count of the DeleteByThingID invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockDeleteByThingIDDone() bool {
	for _, e := range m.DeleteByThingIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteByThingIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteByThingIDCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDeleteByThingID != nil && mm_atomic.LoadUint64(&m.afterDeleteByThingIDCounter) < 1 {
		return false
	}
	return true
}

// MinimockDeleteByThingIDInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockDeleteByThingIDInspect() {
	for _, e := range m.DeleteByThingIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.DeleteByThingID with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteByThingIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteByThingIDCounter) < 1 {
		if m.DeleteByThingIDMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.DeleteByThingID")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.DeleteByThingID with params: %#v", *m.DeleteByThingIDMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDeleteByThingID != nil && mm_atomic.LoadUint64(&m.afterDeleteByThingIDCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.DeleteByThingID")
	}
}

type mThingTagRepositoryMockGetByPlaceID struct {
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockGetByPlaceIDExpectation
	expectations       []*ThingTagRepositoryMockGetByPlaceIDExpectation

	callArgs []*ThingTagRepositoryMockGetByPlaceIDParams
	mutex    sync.RWMutex
}

// ThingTagRepositoryMockGetByPlaceIDExpectation specifies expectation struct of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDExpectation struct {
	mock    *ThingTagRepositoryMock
	params  *ThingTagRepositoryMockGetByPlaceIDParams
	results *ThingTagRepositoryMockGetByPlaceIDResults
	Counter uint64
}

// ThingTagRepositoryMockGetByPlaceIDParams contains parameters of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDParams struct {
	ctx     context.Context
	placeID int
}

// ThingTagRepositoryMockGetByPlaceIDResults contains results of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDResults struct {
	ta1 []models.ThingTag
	err error
}

// Expect sets up expected params for ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Expect(ctx context.Context, placeID int) *mThingTagRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	if mmGetByPlaceID.defaultExpectation == nil {
		mmGetByPlaceID.defaultExpectation = &ThingTagRepositoryMockGetByPlaceIDExpectation{}
	}

	mmGetByPlaceID.defaultExpectation.params = &ThingTagRepositoryMockGetByPlaceIDParams{ctx, placeID}
	for _, e := range mmGetByPlaceID.expectations {
		if minimock.Equal(e.params, mmGetByPlaceID.defaultExpectation.params) {
			mmGetByPlaceID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByPlaceID.defaultExpectation.params)
		}
	}

	return mmGetByPlaceID
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Inspect(f func(ctx context.Context, placeID int)) *mThingTagRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.inspectFuncGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.GetByPlaceID")
	}

	mmGetByPlaceID.mock.inspectFuncGetByPlaceID = f

	return mmGetByPlaceID
}

// Return sets up results that will be returned by ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Return(ta1 []models.ThingTag, err error) *ThingTagRepositoryMock {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	if mmGetByPlaceID.defaultExpectation == nil {
		mmGetByPlaceID.defaultExpectation = &ThingTagRepositoryMockGetByPlaceIDExpectation{mock: mmGetByPlaceID.mock}
	}
	mmGetByPlaceID.defaultExpectation.results = &ThingTagRepositoryMockGetByPlaceIDResults{ta1, err}
	return mmGetByPlaceID.mock
}

// Set uses given function f to mock the ThingTagRepository.GetByPlaceID method
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Set(f func(ctx context.Context, placeID int) (ta1 []models.ThingTag, err error)) *ThingTagRepositoryMock {
	if mmGetByPlaceID.defaultExpectation != nil {
		mmGetByPlaceID.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.GetByPlaceID method")
	}

	if len(mmGetByPlaceID.expectations) > 0 {
		mmGetByPlaceID.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.GetByPlaceID method")
	}

	mmGetByPlaceID.mock.funcGetByPlaceID = f
	return mmGetByPlaceID.mock
}

// When sets expectation for the ThingTagRepository.GetByPlaceID which will trigger the result defined by the following
// Then helper
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) When(ctx context.Context, placeID int) *ThingTagRepositoryMockGetByPlaceIDExpectation {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockGetByPlaceIDExpectation{
		mock:   mmGetByPlaceID.mock,
		params: &ThingTagRepositoryMockGetByPlaceIDParams{ctx, placeID},
	}
	mmGetByPlaceID.expectations = append(mmGetByPlaceID.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.GetByPlaceID return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockGetByPlaceIDExpectation) Then(ta1 []models.ThingTag, err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockGetByPlaceIDResults{ta1, err}
	return e.mock
}

// GetByPlaceID implements interfaces.ThingTagRepository
func (mmGetByPlaceID *ThingTagRepositoryMock) GetByPlaceID(ctx context.Context, placeID int) (ta1 []models.ThingTag, err error) {
	mm_atomic.AddUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter, 1)
	defer mm_atomic.AddUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter, 1)

	if mmGetByPlaceID.inspectFuncGetByPlaceID != nil {
		mmGetByPlaceID.inspectFuncGetByPlaceID(ctx, placeID)
	}

	mm_params := &ThingTagRepositoryMockGetByPlaceIDParams{ctx, placeID}

	// Record call args
	mmGetByPlaceID.GetByPlaceIDMock.mutex.Lock()
	mmGetByPlaceID.GetByPlaceIDMock.callArgs = append(mmGetByPlaceID.GetByPlaceIDMock.callArgs, mm_params)
	mmGetByPlaceID.GetByPlaceIDMock.mutex.Unlock()

	for _, e := range mmGetByPlaceID.GetByPlaceIDMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.ta1, e.results.err
		}
	}

	if mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.Counter, 1)
		mm_want := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.params
		mm_got := ThingTagRepositoryMockGetByPlaceIDParams{ctx, placeID}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmGetByPlaceID.t.Errorf("ThingTagRepositoryMock.GetByPlaceID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.results
		if mm_results == nil {
			mmGetByPlaceID.t.Fatal("No results are set for the ThingTagRepositoryMock.GetByPlaceID")
		}
		return (*mm_results).ta1, (*mm_results).err
	}
	if mmGetByPlaceID.funcGetByPlaceID != nil {
		return mmGetByPlaceID.funcGetByPlaceID(ctx, placeID)
	}
	mmGetByPlaceID.t.Fatalf("Unexpected call to ThingTagRepositoryMock.GetByPlaceID. %v %v", ctx, placeID)
	return
}

// GetByPlaceIDAfterCounter returns a count of finished ThingTagRepositoryMock.GetByPlaceID invocations
func (mmGetByPlaceID *ThingTagRepositoryMock) GetByPlaceIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter)
}

// GetByPlaceIDBeforeCounter returns a count of ThingTagRepositoryMock.GetByPlaceID invocations
func (mmGetByPlaceID *ThingTagRepositoryMock) GetByPlaceIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.GetByPlaceID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Calls() []*ThingTagRepositoryMockGetByPlaceIDParams {
	mmGetByPlaceID.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockGetByPlaceIDParams, len(mmGetByPlaceID.callArgs))
	copy(argCopy, mmGetByPlaceID.callArgs)

	mmGetByPlaceID.mutex.RUnlock()

	return argCopy
}

// MinimockGetByPlaceIDDone returns true if the count of the GetByPlaceID invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockGetByPlaceIDDone() bool {
	for _, e := range m.GetByPlaceIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetByPlaceIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGetByPlaceID != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		return false
	}
	return true
}

// MinimockGetByPlaceIDInspect logs each unmet expectation
func (m *ThingTagRepositoryMock) MinimockGetByPlaceIDInspect() {
	for _, e := range m.GetByPlaceIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.GetByPlaceID with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetByPlaceIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		if m.GetByPlaceIDMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingTagRepositoryMock.GetByPlaceID")
		} else {
			m.t.Errorf("Expected call to ThingTagRepositoryMock.GetByPlaceID with params: %#v", *m.GetByPlaceIDMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGetByPlaceID != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		m.t.Error("Expected call to ThingTagRepositoryMock.GetByPlaceID")
	}
}

// MinimockFinish checks that all mocked methods have been called the expected number of times
func (m *ThingTagRepositoryMock) MinimockFinish() {
	if !m.minimockDone() {
		m.MinimockAddInspect()

		m.MinimockBeginTxInspect()

		m.MinimockCommitTxInspect()

		m.MinimockDeleteInspect()

		m.MinimockDeleteByTagIDInspect()

		m.MinimockDeleteByThingIDInspect()

		m.MinimockGetByPlaceIDInspect()
		m.t.FailNow()
	}
}

// MinimockWait waits for all mocked methods to be called the expected number of times
func (m *ThingTagRepositoryMock) MinimockWait(timeout mm_time.Duration) {
	timeoutCh := mm_time.After(timeout)
	for {
		if m.minimockDone() {
			return
		}
		select {
		case <-timeoutCh:
			m.MinimockFinish()
			return
		case <-mm_time.After(10 * mm_time.Millisecond):
		}
	}
}

func (m *ThingTagRepositoryMock) minimockDone() bool {
	done := true
	return done &&
		m.MinimockAddDone() &&
		m.MinimockBeginTxDone() &&
		m.MinimockCommitTxDone() &&
		m.MinimockDeleteDone() &&
		m.MinimockDeleteByTagIDDone() &&
		m.MinimockDeleteByThingIDDone() &&
		m.MinimockGetByPlaceIDDone()
}
