-
Notifications
You must be signed in to change notification settings - Fork 58
/
isqlexecer.go
109 lines (98 loc) · 3.14 KB
/
isqlexecer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Code generated by counterfeiter. DO NOT EDIT.
package fakes
import (
"context"
"database/sql"
"sync"
"github.com/InVisionApp/go-health/checkers"
)
type FakeSQLExecer struct {
ExecContextStub func(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
execContextMutex sync.RWMutex
execContextArgsForCall []struct {
ctx context.Context
query string
args []interface{}
}
execContextReturns struct {
result1 sql.Result
result2 error
}
execContextReturnsOnCall map[int]struct {
result1 sql.Result
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeSQLExecer) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
fake.execContextMutex.Lock()
ret, specificReturn := fake.execContextReturnsOnCall[len(fake.execContextArgsForCall)]
fake.execContextArgsForCall = append(fake.execContextArgsForCall, struct {
ctx context.Context
query string
args []interface{}
}{ctx, query, args})
fake.recordInvocation("ExecContext", []interface{}{ctx, query, args})
fake.execContextMutex.Unlock()
if fake.ExecContextStub != nil {
return fake.ExecContextStub(ctx, query, args...)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.execContextReturns.result1, fake.execContextReturns.result2
}
func (fake *FakeSQLExecer) ExecContextCallCount() int {
fake.execContextMutex.RLock()
defer fake.execContextMutex.RUnlock()
return len(fake.execContextArgsForCall)
}
func (fake *FakeSQLExecer) ExecContextArgsForCall(i int) (context.Context, string, []interface{}) {
fake.execContextMutex.RLock()
defer fake.execContextMutex.RUnlock()
return fake.execContextArgsForCall[i].ctx, fake.execContextArgsForCall[i].query, fake.execContextArgsForCall[i].args
}
func (fake *FakeSQLExecer) ExecContextReturns(result1 sql.Result, result2 error) {
fake.ExecContextStub = nil
fake.execContextReturns = struct {
result1 sql.Result
result2 error
}{result1, result2}
}
func (fake *FakeSQLExecer) ExecContextReturnsOnCall(i int, result1 sql.Result, result2 error) {
fake.ExecContextStub = nil
if fake.execContextReturnsOnCall == nil {
fake.execContextReturnsOnCall = make(map[int]struct {
result1 sql.Result
result2 error
})
}
fake.execContextReturnsOnCall[i] = struct {
result1 sql.Result
result2 error
}{result1, result2}
}
func (fake *FakeSQLExecer) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.execContextMutex.RLock()
defer fake.execContextMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeSQLExecer) 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 _ checkers.SQLExecer = new(FakeSQLExecer)