12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430 |
- 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.PlaceImageRepository -o ./mocks/place_image_repository_minimock.go -n PlaceImageRepositoryMock
- import (
- "context"
- "database/sql"
- "sync"
- mm_atomic "sync/atomic"
- mm_time "time"
- "git.dmitriygnatenko.ru/dima/homethings/internal/models"
- "github.com/gojuno/minimock/v3"
- )
- // PlaceImageRepositoryMock implements interfaces.PlaceImageRepository
- type PlaceImageRepositoryMock struct {
- t minimock.Tester
- funcAdd func(ctx context.Context, req models.AddPlaceImageRequest, tx *sql.Tx) (err error)
- inspectFuncAdd func(ctx context.Context, req models.AddPlaceImageRequest, tx *sql.Tx)
- afterAddCounter uint64
- beforeAddCounter uint64
- AddMock mPlaceImageRepositoryMockAdd
- 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 mPlaceImageRepositoryMockBeginTx
- funcCommitTx func(tx *sql.Tx) (err error)
- inspectFuncCommitTx func(tx *sql.Tx)
- afterCommitTxCounter uint64
- beforeCommitTxCounter uint64
- CommitTxMock mPlaceImageRepositoryMockCommitTx
- funcDelete func(ctx context.Context, imageID int, tx *sql.Tx) (err error)
- inspectFuncDelete func(ctx context.Context, imageID int, tx *sql.Tx)
- afterDeleteCounter uint64
- beforeDeleteCounter uint64
- DeleteMock mPlaceImageRepositoryMockDelete
- funcGet func(ctx context.Context, imageID int) (ip1 *models.Image, err error)
- inspectFuncGet func(ctx context.Context, imageID int)
- afterGetCounter uint64
- beforeGetCounter uint64
- GetMock mPlaceImageRepositoryMockGet
- funcGetByPlaceID func(ctx context.Context, placeID int) (ia1 []models.Image, err error)
- inspectFuncGetByPlaceID func(ctx context.Context, placeID int)
- afterGetByPlaceIDCounter uint64
- beforeGetByPlaceIDCounter uint64
- GetByPlaceIDMock mPlaceImageRepositoryMockGetByPlaceID
- }
- // NewPlaceImageRepositoryMock returns a mock for interfaces.PlaceImageRepository
- func NewPlaceImageRepositoryMock(t minimock.Tester) *PlaceImageRepositoryMock {
- m := &PlaceImageRepositoryMock{t: t}
- if controller, ok := t.(minimock.MockController); ok {
- controller.RegisterMocker(m)
- }
- m.AddMock = mPlaceImageRepositoryMockAdd{mock: m}
- m.AddMock.callArgs = []*PlaceImageRepositoryMockAddParams{}
- m.BeginTxMock = mPlaceImageRepositoryMockBeginTx{mock: m}
- m.BeginTxMock.callArgs = []*PlaceImageRepositoryMockBeginTxParams{}
- m.CommitTxMock = mPlaceImageRepositoryMockCommitTx{mock: m}
- m.CommitTxMock.callArgs = []*PlaceImageRepositoryMockCommitTxParams{}
- m.DeleteMock = mPlaceImageRepositoryMockDelete{mock: m}
- m.DeleteMock.callArgs = []*PlaceImageRepositoryMockDeleteParams{}
- m.GetMock = mPlaceImageRepositoryMockGet{mock: m}
- m.GetMock.callArgs = []*PlaceImageRepositoryMockGetParams{}
- m.GetByPlaceIDMock = mPlaceImageRepositoryMockGetByPlaceID{mock: m}
- m.GetByPlaceIDMock.callArgs = []*PlaceImageRepositoryMockGetByPlaceIDParams{}
- return m
- }
- type mPlaceImageRepositoryMockAdd struct {
- mock *PlaceImageRepositoryMock
- defaultExpectation *PlaceImageRepositoryMockAddExpectation
- expectations []*PlaceImageRepositoryMockAddExpectation
- callArgs []*PlaceImageRepositoryMockAddParams
- mutex sync.RWMutex
- }
- // PlaceImageRepositoryMockAddExpectation specifies expectation struct of the PlaceImageRepository.Add
- type PlaceImageRepositoryMockAddExpectation struct {
- mock *PlaceImageRepositoryMock
- params *PlaceImageRepositoryMockAddParams
- results *PlaceImageRepositoryMockAddResults
- Counter uint64
- }
- // PlaceImageRepositoryMockAddParams contains parameters of the PlaceImageRepository.Add
- type PlaceImageRepositoryMockAddParams struct {
- ctx context.Context
- req models.AddPlaceImageRequest
- tx *sql.Tx
- }
- // PlaceImageRepositoryMockAddResults contains results of the PlaceImageRepository.Add
- type PlaceImageRepositoryMockAddResults struct {
- err error
- }
- // Expect sets up expected params for PlaceImageRepository.Add
- func (mmAdd *mPlaceImageRepositoryMockAdd) Expect(ctx context.Context, req models.AddPlaceImageRequest, tx *sql.Tx) *mPlaceImageRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceImageRepositoryMockAddExpectation{}
- }
- mmAdd.defaultExpectation.params = &PlaceImageRepositoryMockAddParams{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 PlaceImageRepository.Add
- func (mmAdd *mPlaceImageRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddPlaceImageRequest, tx *sql.Tx)) *mPlaceImageRepositoryMockAdd {
- if mmAdd.mock.inspectFuncAdd != nil {
- mmAdd.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.Add")
- }
- mmAdd.mock.inspectFuncAdd = f
- return mmAdd
- }
- // Return sets up results that will be returned by PlaceImageRepository.Add
- func (mmAdd *mPlaceImageRepositoryMockAdd) Return(err error) *PlaceImageRepositoryMock {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceImageRepositoryMockAddExpectation{mock: mmAdd.mock}
- }
- mmAdd.defaultExpectation.results = &PlaceImageRepositoryMockAddResults{err}
- return mmAdd.mock
- }
- // Set uses given function f to mock the PlaceImageRepository.Add method
- func (mmAdd *mPlaceImageRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddPlaceImageRequest, tx *sql.Tx) (err error)) *PlaceImageRepositoryMock {
- if mmAdd.defaultExpectation != nil {
- mmAdd.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.Add method")
- }
- if len(mmAdd.expectations) > 0 {
- mmAdd.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.Add method")
- }
- mmAdd.mock.funcAdd = f
- return mmAdd.mock
- }
- // When sets expectation for the PlaceImageRepository.Add which will trigger the result defined by the following
- // Then helper
- func (mmAdd *mPlaceImageRepositoryMockAdd) When(ctx context.Context, req models.AddPlaceImageRequest, tx *sql.Tx) *PlaceImageRepositoryMockAddExpectation {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
- }
- expectation := &PlaceImageRepositoryMockAddExpectation{
- mock: mmAdd.mock,
- params: &PlaceImageRepositoryMockAddParams{ctx, req, tx},
- }
- mmAdd.expectations = append(mmAdd.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceImageRepository.Add return parameters for the expectation previously defined by the When method
- func (e *PlaceImageRepositoryMockAddExpectation) Then(err error) *PlaceImageRepositoryMock {
- e.results = &PlaceImageRepositoryMockAddResults{err}
- return e.mock
- }
- // Add implements interfaces.PlaceImageRepository
- func (mmAdd *PlaceImageRepositoryMock) Add(ctx context.Context, req models.AddPlaceImageRequest, 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 := &PlaceImageRepositoryMockAddParams{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 := PlaceImageRepositoryMockAddParams{ctx, req, tx}
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmAdd.t.Errorf("PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.Add")
- }
- return (*mm_results).err
- }
- if mmAdd.funcAdd != nil {
- return mmAdd.funcAdd(ctx, req, tx)
- }
- mmAdd.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.Add. %v %v %v", ctx, req, tx)
- return
- }
- // AddAfterCounter returns a count of finished PlaceImageRepositoryMock.Add invocations
- func (mmAdd *PlaceImageRepositoryMock) AddAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
- }
- // AddBeforeCounter returns a count of PlaceImageRepositoryMock.Add invocations
- func (mmAdd *PlaceImageRepositoryMock) AddBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.Add.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmAdd *mPlaceImageRepositoryMockAdd) Calls() []*PlaceImageRepositoryMockAddParams {
- mmAdd.mutex.RLock()
- argCopy := make([]*PlaceImageRepositoryMockAddParams, 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 *PlaceImageRepositoryMock) 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 *PlaceImageRepositoryMock) MinimockAddInspect() {
- for _, e := range m.AddMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.Add")
- } else {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.Add")
- }
- }
- type mPlaceImageRepositoryMockBeginTx struct {
- mock *PlaceImageRepositoryMock
- defaultExpectation *PlaceImageRepositoryMockBeginTxExpectation
- expectations []*PlaceImageRepositoryMockBeginTxExpectation
- callArgs []*PlaceImageRepositoryMockBeginTxParams
- mutex sync.RWMutex
- }
- // PlaceImageRepositoryMockBeginTxExpectation specifies expectation struct of the PlaceImageRepository.BeginTx
- type PlaceImageRepositoryMockBeginTxExpectation struct {
- mock *PlaceImageRepositoryMock
- params *PlaceImageRepositoryMockBeginTxParams
- results *PlaceImageRepositoryMockBeginTxResults
- Counter uint64
- }
- // PlaceImageRepositoryMockBeginTxParams contains parameters of the PlaceImageRepository.BeginTx
- type PlaceImageRepositoryMockBeginTxParams struct {
- ctx context.Context
- level sql.IsolationLevel
- }
- // PlaceImageRepositoryMockBeginTxResults contains results of the PlaceImageRepository.BeginTx
- type PlaceImageRepositoryMockBeginTxResults struct {
- tp1 *sql.Tx
- err error
- }
- // Expect sets up expected params for PlaceImageRepository.BeginTx
- func (mmBeginTx *mPlaceImageRepositoryMockBeginTx) Expect(ctx context.Context, level sql.IsolationLevel) *mPlaceImageRepositoryMockBeginTx {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("PlaceImageRepositoryMock.BeginTx mock is already set by Set")
- }
- if mmBeginTx.defaultExpectation == nil {
- mmBeginTx.defaultExpectation = &PlaceImageRepositoryMockBeginTxExpectation{}
- }
- mmBeginTx.defaultExpectation.params = &PlaceImageRepositoryMockBeginTxParams{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 PlaceImageRepository.BeginTx
- func (mmBeginTx *mPlaceImageRepositoryMockBeginTx) Inspect(f func(ctx context.Context, level sql.IsolationLevel)) *mPlaceImageRepositoryMockBeginTx {
- if mmBeginTx.mock.inspectFuncBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.BeginTx")
- }
- mmBeginTx.mock.inspectFuncBeginTx = f
- return mmBeginTx
- }
- // Return sets up results that will be returned by PlaceImageRepository.BeginTx
- func (mmBeginTx *mPlaceImageRepositoryMockBeginTx) Return(tp1 *sql.Tx, err error) *PlaceImageRepositoryMock {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("PlaceImageRepositoryMock.BeginTx mock is already set by Set")
- }
- if mmBeginTx.defaultExpectation == nil {
- mmBeginTx.defaultExpectation = &PlaceImageRepositoryMockBeginTxExpectation{mock: mmBeginTx.mock}
- }
- mmBeginTx.defaultExpectation.results = &PlaceImageRepositoryMockBeginTxResults{tp1, err}
- return mmBeginTx.mock
- }
- // Set uses given function f to mock the PlaceImageRepository.BeginTx method
- func (mmBeginTx *mPlaceImageRepositoryMockBeginTx) Set(f func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)) *PlaceImageRepositoryMock {
- if mmBeginTx.defaultExpectation != nil {
- mmBeginTx.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.BeginTx method")
- }
- if len(mmBeginTx.expectations) > 0 {
- mmBeginTx.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.BeginTx method")
- }
- mmBeginTx.mock.funcBeginTx = f
- return mmBeginTx.mock
- }
- // When sets expectation for the PlaceImageRepository.BeginTx which will trigger the result defined by the following
- // Then helper
- func (mmBeginTx *mPlaceImageRepositoryMockBeginTx) When(ctx context.Context, level sql.IsolationLevel) *PlaceImageRepositoryMockBeginTxExpectation {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("PlaceImageRepositoryMock.BeginTx mock is already set by Set")
- }
- expectation := &PlaceImageRepositoryMockBeginTxExpectation{
- mock: mmBeginTx.mock,
- params: &PlaceImageRepositoryMockBeginTxParams{ctx, level},
- }
- mmBeginTx.expectations = append(mmBeginTx.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceImageRepository.BeginTx return parameters for the expectation previously defined by the When method
- func (e *PlaceImageRepositoryMockBeginTxExpectation) Then(tp1 *sql.Tx, err error) *PlaceImageRepositoryMock {
- e.results = &PlaceImageRepositoryMockBeginTxResults{tp1, err}
- return e.mock
- }
- // BeginTx implements interfaces.PlaceImageRepository
- func (mmBeginTx *PlaceImageRepositoryMock) 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 := &PlaceImageRepositoryMockBeginTxParams{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 := PlaceImageRepositoryMockBeginTxParams{ctx, level}
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmBeginTx.t.Errorf("PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.BeginTx")
- }
- return (*mm_results).tp1, (*mm_results).err
- }
- if mmBeginTx.funcBeginTx != nil {
- return mmBeginTx.funcBeginTx(ctx, level)
- }
- mmBeginTx.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.BeginTx. %v %v", ctx, level)
- return
- }
- // BeginTxAfterCounter returns a count of finished PlaceImageRepositoryMock.BeginTx invocations
- func (mmBeginTx *PlaceImageRepositoryMock) BeginTxAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmBeginTx.afterBeginTxCounter)
- }
- // BeginTxBeforeCounter returns a count of PlaceImageRepositoryMock.BeginTx invocations
- func (mmBeginTx *PlaceImageRepositoryMock) BeginTxBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmBeginTx.beforeBeginTxCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.BeginTx.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmBeginTx *mPlaceImageRepositoryMockBeginTx) Calls() []*PlaceImageRepositoryMockBeginTxParams {
- mmBeginTx.mutex.RLock()
- argCopy := make([]*PlaceImageRepositoryMockBeginTxParams, 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 *PlaceImageRepositoryMock) 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 *PlaceImageRepositoryMock) MinimockBeginTxInspect() {
- for _, e := range m.BeginTxMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.BeginTx")
- } else {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.BeginTx")
- }
- }
- type mPlaceImageRepositoryMockCommitTx struct {
- mock *PlaceImageRepositoryMock
- defaultExpectation *PlaceImageRepositoryMockCommitTxExpectation
- expectations []*PlaceImageRepositoryMockCommitTxExpectation
- callArgs []*PlaceImageRepositoryMockCommitTxParams
- mutex sync.RWMutex
- }
- // PlaceImageRepositoryMockCommitTxExpectation specifies expectation struct of the PlaceImageRepository.CommitTx
- type PlaceImageRepositoryMockCommitTxExpectation struct {
- mock *PlaceImageRepositoryMock
- params *PlaceImageRepositoryMockCommitTxParams
- results *PlaceImageRepositoryMockCommitTxResults
- Counter uint64
- }
- // PlaceImageRepositoryMockCommitTxParams contains parameters of the PlaceImageRepository.CommitTx
- type PlaceImageRepositoryMockCommitTxParams struct {
- tx *sql.Tx
- }
- // PlaceImageRepositoryMockCommitTxResults contains results of the PlaceImageRepository.CommitTx
- type PlaceImageRepositoryMockCommitTxResults struct {
- err error
- }
- // Expect sets up expected params for PlaceImageRepository.CommitTx
- func (mmCommitTx *mPlaceImageRepositoryMockCommitTx) Expect(tx *sql.Tx) *mPlaceImageRepositoryMockCommitTx {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("PlaceImageRepositoryMock.CommitTx mock is already set by Set")
- }
- if mmCommitTx.defaultExpectation == nil {
- mmCommitTx.defaultExpectation = &PlaceImageRepositoryMockCommitTxExpectation{}
- }
- mmCommitTx.defaultExpectation.params = &PlaceImageRepositoryMockCommitTxParams{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 PlaceImageRepository.CommitTx
- func (mmCommitTx *mPlaceImageRepositoryMockCommitTx) Inspect(f func(tx *sql.Tx)) *mPlaceImageRepositoryMockCommitTx {
- if mmCommitTx.mock.inspectFuncCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.CommitTx")
- }
- mmCommitTx.mock.inspectFuncCommitTx = f
- return mmCommitTx
- }
- // Return sets up results that will be returned by PlaceImageRepository.CommitTx
- func (mmCommitTx *mPlaceImageRepositoryMockCommitTx) Return(err error) *PlaceImageRepositoryMock {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("PlaceImageRepositoryMock.CommitTx mock is already set by Set")
- }
- if mmCommitTx.defaultExpectation == nil {
- mmCommitTx.defaultExpectation = &PlaceImageRepositoryMockCommitTxExpectation{mock: mmCommitTx.mock}
- }
- mmCommitTx.defaultExpectation.results = &PlaceImageRepositoryMockCommitTxResults{err}
- return mmCommitTx.mock
- }
- // Set uses given function f to mock the PlaceImageRepository.CommitTx method
- func (mmCommitTx *mPlaceImageRepositoryMockCommitTx) Set(f func(tx *sql.Tx) (err error)) *PlaceImageRepositoryMock {
- if mmCommitTx.defaultExpectation != nil {
- mmCommitTx.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.CommitTx method")
- }
- if len(mmCommitTx.expectations) > 0 {
- mmCommitTx.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.CommitTx method")
- }
- mmCommitTx.mock.funcCommitTx = f
- return mmCommitTx.mock
- }
- // When sets expectation for the PlaceImageRepository.CommitTx which will trigger the result defined by the following
- // Then helper
- func (mmCommitTx *mPlaceImageRepositoryMockCommitTx) When(tx *sql.Tx) *PlaceImageRepositoryMockCommitTxExpectation {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("PlaceImageRepositoryMock.CommitTx mock is already set by Set")
- }
- expectation := &PlaceImageRepositoryMockCommitTxExpectation{
- mock: mmCommitTx.mock,
- params: &PlaceImageRepositoryMockCommitTxParams{tx},
- }
- mmCommitTx.expectations = append(mmCommitTx.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceImageRepository.CommitTx return parameters for the expectation previously defined by the When method
- func (e *PlaceImageRepositoryMockCommitTxExpectation) Then(err error) *PlaceImageRepositoryMock {
- e.results = &PlaceImageRepositoryMockCommitTxResults{err}
- return e.mock
- }
- // CommitTx implements interfaces.PlaceImageRepository
- func (mmCommitTx *PlaceImageRepositoryMock) 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 := &PlaceImageRepositoryMockCommitTxParams{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 := PlaceImageRepositoryMockCommitTxParams{tx}
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmCommitTx.t.Errorf("PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.CommitTx")
- }
- return (*mm_results).err
- }
- if mmCommitTx.funcCommitTx != nil {
- return mmCommitTx.funcCommitTx(tx)
- }
- mmCommitTx.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.CommitTx. %v", tx)
- return
- }
- // CommitTxAfterCounter returns a count of finished PlaceImageRepositoryMock.CommitTx invocations
- func (mmCommitTx *PlaceImageRepositoryMock) CommitTxAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmCommitTx.afterCommitTxCounter)
- }
- // CommitTxBeforeCounter returns a count of PlaceImageRepositoryMock.CommitTx invocations
- func (mmCommitTx *PlaceImageRepositoryMock) CommitTxBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmCommitTx.beforeCommitTxCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.CommitTx.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmCommitTx *mPlaceImageRepositoryMockCommitTx) Calls() []*PlaceImageRepositoryMockCommitTxParams {
- mmCommitTx.mutex.RLock()
- argCopy := make([]*PlaceImageRepositoryMockCommitTxParams, 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 *PlaceImageRepositoryMock) 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 *PlaceImageRepositoryMock) MinimockCommitTxInspect() {
- for _, e := range m.CommitTxMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.CommitTx")
- } else {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.CommitTx")
- }
- }
- type mPlaceImageRepositoryMockDelete struct {
- mock *PlaceImageRepositoryMock
- defaultExpectation *PlaceImageRepositoryMockDeleteExpectation
- expectations []*PlaceImageRepositoryMockDeleteExpectation
- callArgs []*PlaceImageRepositoryMockDeleteParams
- mutex sync.RWMutex
- }
- // PlaceImageRepositoryMockDeleteExpectation specifies expectation struct of the PlaceImageRepository.Delete
- type PlaceImageRepositoryMockDeleteExpectation struct {
- mock *PlaceImageRepositoryMock
- params *PlaceImageRepositoryMockDeleteParams
- results *PlaceImageRepositoryMockDeleteResults
- Counter uint64
- }
- // PlaceImageRepositoryMockDeleteParams contains parameters of the PlaceImageRepository.Delete
- type PlaceImageRepositoryMockDeleteParams struct {
- ctx context.Context
- imageID int
- tx *sql.Tx
- }
- // PlaceImageRepositoryMockDeleteResults contains results of the PlaceImageRepository.Delete
- type PlaceImageRepositoryMockDeleteResults struct {
- err error
- }
- // Expect sets up expected params for PlaceImageRepository.Delete
- func (mmDelete *mPlaceImageRepositoryMockDelete) Expect(ctx context.Context, imageID int, tx *sql.Tx) *mPlaceImageRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &PlaceImageRepositoryMockDeleteExpectation{}
- }
- mmDelete.defaultExpectation.params = &PlaceImageRepositoryMockDeleteParams{ctx, imageID, 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 PlaceImageRepository.Delete
- func (mmDelete *mPlaceImageRepositoryMockDelete) Inspect(f func(ctx context.Context, imageID int, tx *sql.Tx)) *mPlaceImageRepositoryMockDelete {
- if mmDelete.mock.inspectFuncDelete != nil {
- mmDelete.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.Delete")
- }
- mmDelete.mock.inspectFuncDelete = f
- return mmDelete
- }
- // Return sets up results that will be returned by PlaceImageRepository.Delete
- func (mmDelete *mPlaceImageRepositoryMockDelete) Return(err error) *PlaceImageRepositoryMock {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &PlaceImageRepositoryMockDeleteExpectation{mock: mmDelete.mock}
- }
- mmDelete.defaultExpectation.results = &PlaceImageRepositoryMockDeleteResults{err}
- return mmDelete.mock
- }
- // Set uses given function f to mock the PlaceImageRepository.Delete method
- func (mmDelete *mPlaceImageRepositoryMockDelete) Set(f func(ctx context.Context, imageID int, tx *sql.Tx) (err error)) *PlaceImageRepositoryMock {
- if mmDelete.defaultExpectation != nil {
- mmDelete.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.Delete method")
- }
- if len(mmDelete.expectations) > 0 {
- mmDelete.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.Delete method")
- }
- mmDelete.mock.funcDelete = f
- return mmDelete.mock
- }
- // When sets expectation for the PlaceImageRepository.Delete which will trigger the result defined by the following
- // Then helper
- func (mmDelete *mPlaceImageRepositoryMockDelete) When(ctx context.Context, imageID int, tx *sql.Tx) *PlaceImageRepositoryMockDeleteExpectation {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
- }
- expectation := &PlaceImageRepositoryMockDeleteExpectation{
- mock: mmDelete.mock,
- params: &PlaceImageRepositoryMockDeleteParams{ctx, imageID, tx},
- }
- mmDelete.expectations = append(mmDelete.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceImageRepository.Delete return parameters for the expectation previously defined by the When method
- func (e *PlaceImageRepositoryMockDeleteExpectation) Then(err error) *PlaceImageRepositoryMock {
- e.results = &PlaceImageRepositoryMockDeleteResults{err}
- return e.mock
- }
- // Delete implements interfaces.PlaceImageRepository
- func (mmDelete *PlaceImageRepositoryMock) Delete(ctx context.Context, imageID int, 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, imageID, tx)
- }
- mm_params := &PlaceImageRepositoryMockDeleteParams{ctx, imageID, 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 := PlaceImageRepositoryMockDeleteParams{ctx, imageID, tx}
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmDelete.t.Errorf("PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.Delete")
- }
- return (*mm_results).err
- }
- if mmDelete.funcDelete != nil {
- return mmDelete.funcDelete(ctx, imageID, tx)
- }
- mmDelete.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.Delete. %v %v %v", ctx, imageID, tx)
- return
- }
- // DeleteAfterCounter returns a count of finished PlaceImageRepositoryMock.Delete invocations
- func (mmDelete *PlaceImageRepositoryMock) DeleteAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
- }
- // DeleteBeforeCounter returns a count of PlaceImageRepositoryMock.Delete invocations
- func (mmDelete *PlaceImageRepositoryMock) DeleteBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.Delete.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmDelete *mPlaceImageRepositoryMockDelete) Calls() []*PlaceImageRepositoryMockDeleteParams {
- mmDelete.mutex.RLock()
- argCopy := make([]*PlaceImageRepositoryMockDeleteParams, 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 *PlaceImageRepositoryMock) 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 *PlaceImageRepositoryMock) MinimockDeleteInspect() {
- for _, e := range m.DeleteMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.Delete")
- } else {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.Delete")
- }
- }
- type mPlaceImageRepositoryMockGet struct {
- mock *PlaceImageRepositoryMock
- defaultExpectation *PlaceImageRepositoryMockGetExpectation
- expectations []*PlaceImageRepositoryMockGetExpectation
- callArgs []*PlaceImageRepositoryMockGetParams
- mutex sync.RWMutex
- }
- // PlaceImageRepositoryMockGetExpectation specifies expectation struct of the PlaceImageRepository.Get
- type PlaceImageRepositoryMockGetExpectation struct {
- mock *PlaceImageRepositoryMock
- params *PlaceImageRepositoryMockGetParams
- results *PlaceImageRepositoryMockGetResults
- Counter uint64
- }
- // PlaceImageRepositoryMockGetParams contains parameters of the PlaceImageRepository.Get
- type PlaceImageRepositoryMockGetParams struct {
- ctx context.Context
- imageID int
- }
- // PlaceImageRepositoryMockGetResults contains results of the PlaceImageRepository.Get
- type PlaceImageRepositoryMockGetResults struct {
- ip1 *models.Image
- err error
- }
- // Expect sets up expected params for PlaceImageRepository.Get
- func (mmGet *mPlaceImageRepositoryMockGet) Expect(ctx context.Context, imageID int) *mPlaceImageRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &PlaceImageRepositoryMockGetExpectation{}
- }
- mmGet.defaultExpectation.params = &PlaceImageRepositoryMockGetParams{ctx, imageID}
- for _, e := range mmGet.expectations {
- if minimock.Equal(e.params, mmGet.defaultExpectation.params) {
- mmGet.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGet.defaultExpectation.params)
- }
- }
- return mmGet
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceImageRepository.Get
- func (mmGet *mPlaceImageRepositoryMockGet) Inspect(f func(ctx context.Context, imageID int)) *mPlaceImageRepositoryMockGet {
- if mmGet.mock.inspectFuncGet != nil {
- mmGet.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.Get")
- }
- mmGet.mock.inspectFuncGet = f
- return mmGet
- }
- // Return sets up results that will be returned by PlaceImageRepository.Get
- func (mmGet *mPlaceImageRepositoryMockGet) Return(ip1 *models.Image, err error) *PlaceImageRepositoryMock {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &PlaceImageRepositoryMockGetExpectation{mock: mmGet.mock}
- }
- mmGet.defaultExpectation.results = &PlaceImageRepositoryMockGetResults{ip1, err}
- return mmGet.mock
- }
- // Set uses given function f to mock the PlaceImageRepository.Get method
- func (mmGet *mPlaceImageRepositoryMockGet) Set(f func(ctx context.Context, imageID int) (ip1 *models.Image, err error)) *PlaceImageRepositoryMock {
- if mmGet.defaultExpectation != nil {
- mmGet.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.Get method")
- }
- if len(mmGet.expectations) > 0 {
- mmGet.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.Get method")
- }
- mmGet.mock.funcGet = f
- return mmGet.mock
- }
- // When sets expectation for the PlaceImageRepository.Get which will trigger the result defined by the following
- // Then helper
- func (mmGet *mPlaceImageRepositoryMockGet) When(ctx context.Context, imageID int) *PlaceImageRepositoryMockGetExpectation {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
- }
- expectation := &PlaceImageRepositoryMockGetExpectation{
- mock: mmGet.mock,
- params: &PlaceImageRepositoryMockGetParams{ctx, imageID},
- }
- mmGet.expectations = append(mmGet.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceImageRepository.Get return parameters for the expectation previously defined by the When method
- func (e *PlaceImageRepositoryMockGetExpectation) Then(ip1 *models.Image, err error) *PlaceImageRepositoryMock {
- e.results = &PlaceImageRepositoryMockGetResults{ip1, err}
- return e.mock
- }
- // Get implements interfaces.PlaceImageRepository
- func (mmGet *PlaceImageRepositoryMock) Get(ctx context.Context, imageID int) (ip1 *models.Image, err error) {
- mm_atomic.AddUint64(&mmGet.beforeGetCounter, 1)
- defer mm_atomic.AddUint64(&mmGet.afterGetCounter, 1)
- if mmGet.inspectFuncGet != nil {
- mmGet.inspectFuncGet(ctx, imageID)
- }
- mm_params := &PlaceImageRepositoryMockGetParams{ctx, imageID}
- // Record call args
- mmGet.GetMock.mutex.Lock()
- mmGet.GetMock.callArgs = append(mmGet.GetMock.callArgs, mm_params)
- mmGet.GetMock.mutex.Unlock()
- for _, e := range mmGet.GetMock.expectations {
- if minimock.Equal(e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.ip1, e.results.err
- }
- }
- if mmGet.GetMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGet.GetMock.defaultExpectation.Counter, 1)
- mm_want := mmGet.GetMock.defaultExpectation.params
- mm_got := PlaceImageRepositoryMockGetParams{ctx, imageID}
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGet.t.Errorf("PlaceImageRepositoryMock.Get got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGet.GetMock.defaultExpectation.results
- if mm_results == nil {
- mmGet.t.Fatal("No results are set for the PlaceImageRepositoryMock.Get")
- }
- return (*mm_results).ip1, (*mm_results).err
- }
- if mmGet.funcGet != nil {
- return mmGet.funcGet(ctx, imageID)
- }
- mmGet.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.Get. %v %v", ctx, imageID)
- return
- }
- // GetAfterCounter returns a count of finished PlaceImageRepositoryMock.Get invocations
- func (mmGet *PlaceImageRepositoryMock) GetAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGet.afterGetCounter)
- }
- // GetBeforeCounter returns a count of PlaceImageRepositoryMock.Get invocations
- func (mmGet *PlaceImageRepositoryMock) GetBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGet.beforeGetCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.Get.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGet *mPlaceImageRepositoryMockGet) Calls() []*PlaceImageRepositoryMockGetParams {
- mmGet.mutex.RLock()
- argCopy := make([]*PlaceImageRepositoryMockGetParams, len(mmGet.callArgs))
- copy(argCopy, mmGet.callArgs)
- mmGet.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetDone returns true if the count of the Get invocations corresponds
- // the number of defined expectations
- func (m *PlaceImageRepositoryMock) MinimockGetDone() bool {
- for _, e := range m.GetMock.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.GetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
- return false
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGet != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
- return false
- }
- return true
- }
- // MinimockGetInspect logs each unmet expectation
- func (m *PlaceImageRepositoryMock) MinimockGetInspect() {
- for _, e := range m.GetMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.Get with params: %#v", *e.params)
- }
- }
- // if default expectation was set then invocations count should be greater than zero
- if m.GetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
- if m.GetMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to PlaceImageRepositoryMock.Get")
- } else {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.Get with params: %#v", *m.GetMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGet != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
- m.t.Error("Expected call to PlaceImageRepositoryMock.Get")
- }
- }
- type mPlaceImageRepositoryMockGetByPlaceID struct {
- mock *PlaceImageRepositoryMock
- defaultExpectation *PlaceImageRepositoryMockGetByPlaceIDExpectation
- expectations []*PlaceImageRepositoryMockGetByPlaceIDExpectation
- callArgs []*PlaceImageRepositoryMockGetByPlaceIDParams
- mutex sync.RWMutex
- }
- // PlaceImageRepositoryMockGetByPlaceIDExpectation specifies expectation struct of the PlaceImageRepository.GetByPlaceID
- type PlaceImageRepositoryMockGetByPlaceIDExpectation struct {
- mock *PlaceImageRepositoryMock
- params *PlaceImageRepositoryMockGetByPlaceIDParams
- results *PlaceImageRepositoryMockGetByPlaceIDResults
- Counter uint64
- }
- // PlaceImageRepositoryMockGetByPlaceIDParams contains parameters of the PlaceImageRepository.GetByPlaceID
- type PlaceImageRepositoryMockGetByPlaceIDParams struct {
- ctx context.Context
- placeID int
- }
- // PlaceImageRepositoryMockGetByPlaceIDResults contains results of the PlaceImageRepository.GetByPlaceID
- type PlaceImageRepositoryMockGetByPlaceIDResults struct {
- ia1 []models.Image
- err error
- }
- // Expect sets up expected params for PlaceImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Expect(ctx context.Context, placeID int) *mPlaceImageRepositoryMockGetByPlaceID {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- if mmGetByPlaceID.defaultExpectation == nil {
- mmGetByPlaceID.defaultExpectation = &PlaceImageRepositoryMockGetByPlaceIDExpectation{}
- }
- mmGetByPlaceID.defaultExpectation.params = &PlaceImageRepositoryMockGetByPlaceIDParams{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 PlaceImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Inspect(f func(ctx context.Context, placeID int)) *mPlaceImageRepositoryMockGetByPlaceID {
- if mmGetByPlaceID.mock.inspectFuncGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.GetByPlaceID")
- }
- mmGetByPlaceID.mock.inspectFuncGetByPlaceID = f
- return mmGetByPlaceID
- }
- // Return sets up results that will be returned by PlaceImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Return(ia1 []models.Image, err error) *PlaceImageRepositoryMock {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- if mmGetByPlaceID.defaultExpectation == nil {
- mmGetByPlaceID.defaultExpectation = &PlaceImageRepositoryMockGetByPlaceIDExpectation{mock: mmGetByPlaceID.mock}
- }
- mmGetByPlaceID.defaultExpectation.results = &PlaceImageRepositoryMockGetByPlaceIDResults{ia1, err}
- return mmGetByPlaceID.mock
- }
- // Set uses given function f to mock the PlaceImageRepository.GetByPlaceID method
- func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Set(f func(ctx context.Context, placeID int) (ia1 []models.Image, err error)) *PlaceImageRepositoryMock {
- if mmGetByPlaceID.defaultExpectation != nil {
- mmGetByPlaceID.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.GetByPlaceID method")
- }
- if len(mmGetByPlaceID.expectations) > 0 {
- mmGetByPlaceID.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.GetByPlaceID method")
- }
- mmGetByPlaceID.mock.funcGetByPlaceID = f
- return mmGetByPlaceID.mock
- }
- // When sets expectation for the PlaceImageRepository.GetByPlaceID which will trigger the result defined by the following
- // Then helper
- func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) When(ctx context.Context, placeID int) *PlaceImageRepositoryMockGetByPlaceIDExpectation {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- expectation := &PlaceImageRepositoryMockGetByPlaceIDExpectation{
- mock: mmGetByPlaceID.mock,
- params: &PlaceImageRepositoryMockGetByPlaceIDParams{ctx, placeID},
- }
- mmGetByPlaceID.expectations = append(mmGetByPlaceID.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceImageRepository.GetByPlaceID return parameters for the expectation previously defined by the When method
- func (e *PlaceImageRepositoryMockGetByPlaceIDExpectation) Then(ia1 []models.Image, err error) *PlaceImageRepositoryMock {
- e.results = &PlaceImageRepositoryMockGetByPlaceIDResults{ia1, err}
- return e.mock
- }
- // GetByPlaceID implements interfaces.PlaceImageRepository
- func (mmGetByPlaceID *PlaceImageRepositoryMock) GetByPlaceID(ctx context.Context, placeID int) (ia1 []models.Image, 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 := &PlaceImageRepositoryMockGetByPlaceIDParams{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.ia1, e.results.err
- }
- }
- if mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.Counter, 1)
- mm_want := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.params
- mm_got := PlaceImageRepositoryMockGetByPlaceIDParams{ctx, placeID}
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGetByPlaceID.t.Errorf("PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.GetByPlaceID")
- }
- return (*mm_results).ia1, (*mm_results).err
- }
- if mmGetByPlaceID.funcGetByPlaceID != nil {
- return mmGetByPlaceID.funcGetByPlaceID(ctx, placeID)
- }
- mmGetByPlaceID.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.GetByPlaceID. %v %v", ctx, placeID)
- return
- }
- // GetByPlaceIDAfterCounter returns a count of finished PlaceImageRepositoryMock.GetByPlaceID invocations
- func (mmGetByPlaceID *PlaceImageRepositoryMock) GetByPlaceIDAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter)
- }
- // GetByPlaceIDBeforeCounter returns a count of PlaceImageRepositoryMock.GetByPlaceID invocations
- func (mmGetByPlaceID *PlaceImageRepositoryMock) GetByPlaceIDBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.GetByPlaceID.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Calls() []*PlaceImageRepositoryMockGetByPlaceIDParams {
- mmGetByPlaceID.mutex.RLock()
- argCopy := make([]*PlaceImageRepositoryMockGetByPlaceIDParams, 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 *PlaceImageRepositoryMock) 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 *PlaceImageRepositoryMock) MinimockGetByPlaceIDInspect() {
- for _, e := range m.GetByPlaceIDMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.GetByPlaceID")
- } else {
- m.t.Errorf("Expected call to PlaceImageRepositoryMock.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 PlaceImageRepositoryMock.GetByPlaceID")
- }
- }
- // MinimockFinish checks that all mocked methods have been called the expected number of times
- func (m *PlaceImageRepositoryMock) MinimockFinish() {
- if !m.minimockDone() {
- m.MinimockAddInspect()
- m.MinimockBeginTxInspect()
- m.MinimockCommitTxInspect()
- m.MinimockDeleteInspect()
- m.MinimockGetInspect()
- m.MinimockGetByPlaceIDInspect()
- m.t.FailNow()
- }
- }
- // MinimockWait waits for all mocked methods to be called the expected number of times
- func (m *PlaceImageRepositoryMock) 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 *PlaceImageRepositoryMock) minimockDone() bool {
- done := true
- return done &&
- m.MinimockAddDone() &&
- m.MinimockBeginTxDone() &&
- m.MinimockCommitTxDone() &&
- m.MinimockDeleteDone() &&
- m.MinimockGetDone() &&
- m.MinimockGetByPlaceIDDone()
- }
|