-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock_session.go
130 lines (105 loc) · 3.08 KB
/
mock_session.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package db
import (
"context"
"database/sql"
"time"
"github.com/Masterminds/squirrel"
sq "github.com/Masterminds/squirrel"
"github.com/jmoiron/sqlx"
"github.com/stretchr/testify/mock"
)
var _ SessionInterface = (*MockSession)(nil)
type MockSession struct {
mock.Mock
}
func (m *MockSession) Begin(ctx context.Context) error {
args := m.Called(ctx)
return args.Error(0)
}
func (m *MockSession) BeginTx(ctx context.Context, opts *sql.TxOptions) error {
args := m.Called(ctx, opts)
return args.Error(0)
}
func (m *MockSession) Rollback() error {
args := m.Called()
return args.Error(0)
}
func (m *MockSession) Commit() error {
args := m.Called()
return args.Error(0)
}
func (m *MockSession) GetTx() *sqlx.Tx {
args := m.Called()
return args.Get(0).(*sqlx.Tx)
}
func (m *MockSession) GetTxOptions() *sql.TxOptions {
args := m.Called()
return args.Get(0).(*sql.TxOptions)
}
func (m *MockSession) TruncateTables(ctx context.Context, tables []string) error {
args := m.Called(ctx, tables)
return args.Error(0)
}
func (m *MockSession) Clone() SessionInterface {
args := m.Called()
return args.Get(0).(SessionInterface)
}
func (m *MockSession) Close() error {
args := m.Called()
return args.Error(0)
}
func (m *MockSession) Get(ctx context.Context, dest interface{}, query sq.Sqlizer) error {
args := m.Called(ctx, dest, query)
return args.Error(0)
}
func (m *MockSession) GetRaw(ctx context.Context, dest interface{}, query string, args ...interface{}) error {
argss := m.Called(ctx, dest, query, args)
return argss.Error(0)
}
func (m *MockSession) Query(ctx context.Context, query squirrel.Sqlizer) (*Rows, error) {
args := m.Called(ctx, query)
return args.Get(0).(*Rows), args.Error(1)
}
func (m *MockSession) QueryRaw(ctx context.Context, query string, args ...interface{}) (*Rows, error) {
argss := m.Called(ctx, query, args)
return argss.Get(0).(*Rows), argss.Error(1)
}
func (m *MockSession) Select(ctx context.Context, dest interface{}, query squirrel.Sqlizer) error {
argss := m.Called(ctx, dest, query)
return argss.Error(0)
}
func (m *MockSession) SelectRaw(ctx context.Context,
dest interface{},
query string,
args ...interface{},
) error {
argss := m.Called(ctx, dest, query, args)
return argss.Error(0)
}
func (m *MockSession) GetTable(name string) *Table {
args := m.Called(name)
return args.Get(0).(*Table)
}
func (m *MockSession) Exec(ctx context.Context, query squirrel.Sqlizer) (sql.Result, error) {
args := m.Called(ctx, query)
return args.Get(0).(sql.Result), args.Error(1)
}
func (m *MockSession) ExecRaw(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
argss := m.Called(ctx, query, args)
return argss.Get(0).(sql.Result), argss.Error(1)
}
func (m *MockSession) NoRows(err error) bool {
args := m.Called(err)
return args.Get(0).(bool)
}
func (m *MockSession) Ping(ctx context.Context, timeout time.Duration) error {
return m.Called(ctx, timeout).Error(0)
}
func (m *MockSession) DeleteRange(
ctx context.Context,
start, end int64,
table string,
idCol string,
) (err error) {
return m.Called(ctx, start, end, table, idCol).Error(0)
}