// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq

package postgres

import (
	"context"
	"sync"

	"github.com/jackc/pgx/v4"
)

// dbpoolMock is a mock implementation of dbpool.
//
// 	func TestSomethingThatUsesdbpool(t *testing.T) {
//
// 		// make and configure a mocked dbpool
// 		mockeddbpool := &dbpoolMock{
// 			CloseFunc: func()  {
// 				panic("mock out the Close method")
// 			},
// 			QueryFunc: func(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) {
// 				panic("mock out the Query method")
// 			},
// 		}
//
// 		// use mockeddbpool in code that requires dbpool
// 		// and then make assertions.
//
// 	}
type dbpoolMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func()

	// QueryFunc mocks the Query method.
	QueryFunc func(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

	// calls tracks calls to the methods.
	calls struct {
		// Close holds details about calls to the Close method.
		Close []struct {
		}
		// Query holds details about calls to the Query method.
		Query []struct {
			// Ctx is the ctx argument value.
			Ctx context.Context
			// SQL is the sql argument value.
			SQL string
			// Args is the args argument value.
			Args []interface{}
		}
	}
	lockClose sync.RWMutex
	lockQuery sync.RWMutex
}

// Close calls CloseFunc.
func (mock *dbpoolMock) Close() {
	if mock.CloseFunc == nil {
		panic("dbpoolMock.CloseFunc: method is nil but dbpool.Close was just called")
	}
	callInfo := struct {
	}{}
	mock.lockClose.Lock()
	mock.calls.Close = append(mock.calls.Close, callInfo)
	mock.lockClose.Unlock()
	mock.CloseFunc()
}

// CloseCalls gets all the calls that were made to Close.
// Check the length with:
//     len(mockeddbpool.CloseCalls())
func (mock *dbpoolMock) CloseCalls() []struct {
} {
	var calls []struct {
	}
	mock.lockClose.RLock()
	calls = mock.calls.Close
	mock.lockClose.RUnlock()
	return calls
}

// Query calls QueryFunc.
func (mock *dbpoolMock) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) {
	if mock.QueryFunc == nil {
		panic("dbpoolMock.QueryFunc: method is nil but dbpool.Query was just called")
	}
	callInfo := struct {
		Ctx  context.Context
		SQL  string
		Args []interface{}
	}{
		Ctx:  ctx,
		SQL:  sql,
		Args: args,
	}
	mock.lockQuery.Lock()
	mock.calls.Query = append(mock.calls.Query, callInfo)
	mock.lockQuery.Unlock()
	return mock.QueryFunc(ctx, sql, args...)
}

// QueryCalls gets all the calls that were made to Query.
// Check the length with:
//     len(mockeddbpool.QueryCalls())
func (mock *dbpoolMock) QueryCalls() []struct {
	Ctx  context.Context
	SQL  string
	Args []interface{}
} {
	var calls []struct {
		Ctx  context.Context
		SQL  string
		Args []interface{}
	}
	mock.lockQuery.RLock()
	calls = mock.calls.Query
	mock.lockQuery.RUnlock()
	return calls
}
