/
mock_querySetter.go
171 lines (128 loc) · 4.16 KB
/
mock_querySetter.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Copyright 2020 radiant
//
package mock
import (
"context"
"github.com/W3-Engineers-Ltd/Radiant/client/orm"
"github.com/W3-Engineers-Ltd/Radiant/client/orm/clauses/order_clause"
)
// DoNothingQuerySetter do nothing
// usually you use this to build your mock QuerySetter
type DoNothingQuerySetter struct{}
func (d *DoNothingQuerySetter) OrderClauses(orders ...*order_clause.Order) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) CountWithCtx(ctx context.Context) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) ExistWithCtx(ctx context.Context) bool {
return true
}
func (d *DoNothingQuerySetter) UpdateWithCtx(ctx context.Context, values orm.Params) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) DeleteWithCtx(ctx context.Context) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) PrepareInsertWithCtx(ctx context.Context) (orm.Inserter, error) {
return nil, nil
}
func (d *DoNothingQuerySetter) AllWithCtx(ctx context.Context, container interface{}, cols ...string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) OneWithCtx(ctx context.Context, container interface{}, cols ...string) error {
return nil
}
func (d *DoNothingQuerySetter) ValuesWithCtx(ctx context.Context, results *[]orm.Params, exprs ...string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) ValuesListWithCtx(ctx context.Context, results *[]orm.ParamsList, exprs ...string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) ValuesFlatWithCtx(ctx context.Context, result *orm.ParamsList, expr string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) Aggregate(s string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) Filter(s string, i ...interface{}) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) FilterRaw(s string, s2 string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) Exclude(s string, i ...interface{}) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) SetCond(condition *orm.Condition) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) GetCond() *orm.Condition {
return orm.NewCondition()
}
func (d *DoNothingQuerySetter) Limit(limit interface{}, args ...interface{}) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) Offset(offset interface{}) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) GroupBy(exprs ...string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) OrderBy(exprs ...string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) ForceIndex(indexes ...string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) UseIndex(indexes ...string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) IgnoreIndex(indexes ...string) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) RelatedSel(params ...interface{}) orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) Distinct() orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) ForUpdate() orm.QuerySeter {
return d
}
func (d *DoNothingQuerySetter) Count() (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) Exist() bool {
return true
}
func (d *DoNothingQuerySetter) Update(values orm.Params) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) Delete() (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) PrepareInsert() (orm.Inserter, error) {
return nil, nil
}
func (d *DoNothingQuerySetter) All(container interface{}, cols ...string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) One(container interface{}, cols ...string) error {
return nil
}
func (d *DoNothingQuerySetter) Values(results *[]orm.Params, exprs ...string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) ValuesList(results *[]orm.ParamsList, exprs ...string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) ValuesFlat(result *orm.ParamsList, expr string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) RowsToMap(result *orm.Params, keyCol, valueCol string) (int64, error) {
return 0, nil
}
func (d *DoNothingQuerySetter) RowsToStruct(ptrStruct interface{}, keyCol, valueCol string) (int64, error) {
return 0, nil
}