// Code generated by counterfeiter. DO NOT EDIT.
package scan_test

import (
	sql "database/sql"
	sync "sync"
	"testing"

	scan "github.com/blockloop/scan/v2"
)

func fakeRowsWithColumns(t testing.TB, rowCnt int, cols ...string) *FakeRowsScanner {
	r := &FakeRowsScanner{}
	r.ColumnsReturns(cols, nil)
	r.NextStub = func() bool {
		// return true until the rowCnt is reached
		return r.NextCallCount() <= rowCnt
	}

	return r
}

var record map[string]interface{}

// fakeRowsWithRecords creates a fake row scanner that acts like a sql.DB.Rows
// scanner. You can call Scan(&item.Name, &item.Age), etc
func fakeRowsWithRecords(t testing.TB, cols []string, rows ...[]interface{}) *FakeRowsScanner {
	r := fakeRowsWithColumns(t, len(rows), cols...)
	r.ScanStub = func(ps ...interface{}) error {
		i := r.ScanCallCount() - 1
		if i > len(rows) {
			return nil
		}
		vals := rows[i]

		for j, ptr := range ps {
			if j < len(vals) {
				setValue(ptr, vals[j])
			}
		}
		return nil
	}

	return r
}

type FakeRowsScanner struct {
	CloseStub        func() error
	closeMutex       sync.RWMutex
	closeArgsForCall []struct{}
	closeReturns     struct {
		result1 error
	}
	closeReturnsOnCall map[int]struct {
		result1 error
	}
	ColumnTypesStub        func() ([]*sql.ColumnType, error)
	columnTypesMutex       sync.RWMutex
	columnTypesArgsForCall []struct{}
	columnTypesReturns     struct {
		result1 []*sql.ColumnType
		result2 error
	}
	columnTypesReturnsOnCall map[int]struct {
		result1 []*sql.ColumnType
		result2 error
	}
	ColumnsStub        func() ([]string, error)
	columnsMutex       sync.RWMutex
	columnsArgsForCall []struct{}
	columnsReturns     struct {
		result1 []string
		result2 error
	}
	columnsReturnsOnCall map[int]struct {
		result1 []string
		result2 error
	}
	ErrStub        func() error
	errMutex       sync.RWMutex
	errArgsForCall []struct{}
	errReturns     struct {
		result1 error
	}
	errReturnsOnCall map[int]struct {
		result1 error
	}
	NextStub        func() bool
	nextMutex       sync.RWMutex
	nextArgsForCall []struct{}
	nextReturns     struct {
		result1 bool
	}
	nextReturnsOnCall map[int]struct {
		result1 bool
	}
	ScanStub        func(...interface{}) error
	scanMutex       sync.RWMutex
	scanArgsForCall []struct {
		arg1 []interface{}
	}
	scanReturns struct {
		result1 error
	}
	scanReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeRowsScanner) Close() error {
	fake.closeMutex.Lock()
	ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
	fake.closeArgsForCall = append(fake.closeArgsForCall, struct{}{})
	fake.recordInvocation("Close", []interface{}{})
	fake.closeMutex.Unlock()
	if fake.CloseStub != nil {
		return fake.CloseStub()
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.closeReturns
	return fakeReturns.result1
}

func (fake *FakeRowsScanner) CloseCallCount() int {
	fake.closeMutex.RLock()
	defer fake.closeMutex.RUnlock()
	return len(fake.closeArgsForCall)
}

func (fake *FakeRowsScanner) CloseCalls(stub func() error) {
	fake.closeMutex.Lock()
	defer fake.closeMutex.Unlock()
	fake.CloseStub = stub
}

func (fake *FakeRowsScanner) CloseReturns(result1 error) {
	fake.closeMutex.Lock()
	defer fake.closeMutex.Unlock()
	fake.CloseStub = nil
	fake.closeReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeRowsScanner) CloseReturnsOnCall(i int, result1 error) {
	fake.closeMutex.Lock()
	defer fake.closeMutex.Unlock()
	fake.CloseStub = nil
	if fake.closeReturnsOnCall == nil {
		fake.closeReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.closeReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeRowsScanner) ColumnTypes() ([]*sql.ColumnType, error) {
	fake.columnTypesMutex.Lock()
	ret, specificReturn := fake.columnTypesReturnsOnCall[len(fake.columnTypesArgsForCall)]
	fake.columnTypesArgsForCall = append(fake.columnTypesArgsForCall, struct{}{})
	fake.recordInvocation("ColumnTypes", []interface{}{})
	fake.columnTypesMutex.Unlock()
	if fake.ColumnTypesStub != nil {
		return fake.ColumnTypesStub()
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.columnTypesReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeRowsScanner) ColumnTypesCallCount() int {
	fake.columnTypesMutex.RLock()
	defer fake.columnTypesMutex.RUnlock()
	return len(fake.columnTypesArgsForCall)
}

func (fake *FakeRowsScanner) ColumnTypesCalls(stub func() ([]*sql.ColumnType, error)) {
	fake.columnTypesMutex.Lock()
	defer fake.columnTypesMutex.Unlock()
	fake.ColumnTypesStub = stub
}

func (fake *FakeRowsScanner) ColumnTypesReturns(result1 []*sql.ColumnType, result2 error) {
	fake.columnTypesMutex.Lock()
	defer fake.columnTypesMutex.Unlock()
	fake.ColumnTypesStub = nil
	fake.columnTypesReturns = struct {
		result1 []*sql.ColumnType
		result2 error
	}{result1, result2}
}

func (fake *FakeRowsScanner) ColumnTypesReturnsOnCall(i int, result1 []*sql.ColumnType, result2 error) {
	fake.columnTypesMutex.Lock()
	defer fake.columnTypesMutex.Unlock()
	fake.ColumnTypesStub = nil
	if fake.columnTypesReturnsOnCall == nil {
		fake.columnTypesReturnsOnCall = make(map[int]struct {
			result1 []*sql.ColumnType
			result2 error
		})
	}
	fake.columnTypesReturnsOnCall[i] = struct {
		result1 []*sql.ColumnType
		result2 error
	}{result1, result2}
}

func (fake *FakeRowsScanner) Columns() ([]string, error) {
	fake.columnsMutex.Lock()
	ret, specificReturn := fake.columnsReturnsOnCall[len(fake.columnsArgsForCall)]
	fake.columnsArgsForCall = append(fake.columnsArgsForCall, struct{}{})
	fake.recordInvocation("Columns", []interface{}{})
	fake.columnsMutex.Unlock()
	if fake.ColumnsStub != nil {
		return fake.ColumnsStub()
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.columnsReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeRowsScanner) ColumnsCallCount() int {
	fake.columnsMutex.RLock()
	defer fake.columnsMutex.RUnlock()
	return len(fake.columnsArgsForCall)
}

func (fake *FakeRowsScanner) ColumnsCalls(stub func() ([]string, error)) {
	fake.columnsMutex.Lock()
	defer fake.columnsMutex.Unlock()
	fake.ColumnsStub = stub
}

func (fake *FakeRowsScanner) ColumnsReturns(result1 []string, result2 error) {
	fake.columnsMutex.Lock()
	defer fake.columnsMutex.Unlock()
	fake.ColumnsStub = nil
	fake.columnsReturns = struct {
		result1 []string
		result2 error
	}{result1, result2}
}

func (fake *FakeRowsScanner) ColumnsReturnsOnCall(i int, result1 []string, result2 error) {
	fake.columnsMutex.Lock()
	defer fake.columnsMutex.Unlock()
	fake.ColumnsStub = nil
	if fake.columnsReturnsOnCall == nil {
		fake.columnsReturnsOnCall = make(map[int]struct {
			result1 []string
			result2 error
		})
	}
	fake.columnsReturnsOnCall[i] = struct {
		result1 []string
		result2 error
	}{result1, result2}
}

func (fake *FakeRowsScanner) Err() error {
	fake.errMutex.Lock()
	ret, specificReturn := fake.errReturnsOnCall[len(fake.errArgsForCall)]
	fake.errArgsForCall = append(fake.errArgsForCall, struct{}{})
	fake.recordInvocation("Err", []interface{}{})
	fake.errMutex.Unlock()
	if fake.ErrStub != nil {
		return fake.ErrStub()
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.errReturns
	return fakeReturns.result1
}

func (fake *FakeRowsScanner) ErrCallCount() int {
	fake.errMutex.RLock()
	defer fake.errMutex.RUnlock()
	return len(fake.errArgsForCall)
}

func (fake *FakeRowsScanner) ErrCalls(stub func() error) {
	fake.errMutex.Lock()
	defer fake.errMutex.Unlock()
	fake.ErrStub = stub
}

func (fake *FakeRowsScanner) ErrReturns(result1 error) {
	fake.errMutex.Lock()
	defer fake.errMutex.Unlock()
	fake.ErrStub = nil
	fake.errReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeRowsScanner) ErrReturnsOnCall(i int, result1 error) {
	fake.errMutex.Lock()
	defer fake.errMutex.Unlock()
	fake.ErrStub = nil
	if fake.errReturnsOnCall == nil {
		fake.errReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.errReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeRowsScanner) Next() bool {
	fake.nextMutex.Lock()
	ret, specificReturn := fake.nextReturnsOnCall[len(fake.nextArgsForCall)]
	fake.nextArgsForCall = append(fake.nextArgsForCall, struct{}{})
	fake.recordInvocation("Next", []interface{}{})
	fake.nextMutex.Unlock()
	if fake.NextStub != nil {
		return fake.NextStub()
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.nextReturns
	return fakeReturns.result1
}

func (fake *FakeRowsScanner) NextCallCount() int {
	fake.nextMutex.RLock()
	defer fake.nextMutex.RUnlock()
	return len(fake.nextArgsForCall)
}

func (fake *FakeRowsScanner) NextCalls(stub func() bool) {
	fake.nextMutex.Lock()
	defer fake.nextMutex.Unlock()
	fake.NextStub = stub
}

func (fake *FakeRowsScanner) NextReturns(result1 bool) {
	fake.nextMutex.Lock()
	defer fake.nextMutex.Unlock()
	fake.NextStub = nil
	fake.nextReturns = struct {
		result1 bool
	}{result1}
}

func (fake *FakeRowsScanner) NextReturnsOnCall(i int, result1 bool) {
	fake.nextMutex.Lock()
	defer fake.nextMutex.Unlock()
	fake.NextStub = nil
	if fake.nextReturnsOnCall == nil {
		fake.nextReturnsOnCall = make(map[int]struct {
			result1 bool
		})
	}
	fake.nextReturnsOnCall[i] = struct {
		result1 bool
	}{result1}
}

func (fake *FakeRowsScanner) Scan(arg1 ...interface{}) error {
	fake.scanMutex.Lock()
	ret, specificReturn := fake.scanReturnsOnCall[len(fake.scanArgsForCall)]
	fake.scanArgsForCall = append(fake.scanArgsForCall, struct {
		arg1 []interface{}
	}{arg1})
	fake.recordInvocation("Scan", []interface{}{arg1})
	fake.scanMutex.Unlock()
	if fake.ScanStub != nil {
		return fake.ScanStub(arg1...)
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.scanReturns
	return fakeReturns.result1
}

func (fake *FakeRowsScanner) ScanCallCount() int {
	fake.scanMutex.RLock()
	defer fake.scanMutex.RUnlock()
	return len(fake.scanArgsForCall)
}

func (fake *FakeRowsScanner) ScanCalls(stub func(...interface{}) error) {
	fake.scanMutex.Lock()
	defer fake.scanMutex.Unlock()
	fake.ScanStub = stub
}

func (fake *FakeRowsScanner) ScanArgsForCall(i int) []interface{} {
	fake.scanMutex.RLock()
	defer fake.scanMutex.RUnlock()
	argsForCall := fake.scanArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeRowsScanner) ScanReturns(result1 error) {
	fake.scanMutex.Lock()
	defer fake.scanMutex.Unlock()
	fake.ScanStub = nil
	fake.scanReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeRowsScanner) ScanReturnsOnCall(i int, result1 error) {
	fake.scanMutex.Lock()
	defer fake.scanMutex.Unlock()
	fake.ScanStub = nil
	if fake.scanReturnsOnCall == nil {
		fake.scanReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.scanReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeRowsScanner) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.closeMutex.RLock()
	defer fake.closeMutex.RUnlock()
	fake.columnTypesMutex.RLock()
	defer fake.columnTypesMutex.RUnlock()
	fake.columnsMutex.RLock()
	defer fake.columnsMutex.RUnlock()
	fake.errMutex.RLock()
	defer fake.errMutex.RUnlock()
	fake.nextMutex.RLock()
	defer fake.nextMutex.RUnlock()
	fake.scanMutex.RLock()
	defer fake.scanMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *FakeRowsScanner) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ scan.RowsScanner = new(FakeRowsScanner)
