@@ -69,62 +69,62 @@ func setupDbPostgres() *sql.DB {
69
69
}
70
70
71
71
func doPersonStuffForProteusTest (ctx context.Context , b * testing.B , wrapper ContextWrapper ) (int64 , * Person , []Person , error ) {
72
- count , err := personDao .Create (ctx , wrapper , "Fred" , 20 )
72
+ _ , err := personDao .Create (ctx , wrapper , "Fred" , 20 )
73
73
if err != nil {
74
74
b .Fatalf ("create failed: %v" , err )
75
75
}
76
76
77
- count , err = personDao .Create (ctx , wrapper , "Bob" , 50 )
77
+ _ , err = personDao .Create (ctx , wrapper , "Bob" , 50 )
78
78
if err != nil {
79
79
b .Fatalf ("create 2 failed: %v" , err )
80
80
}
81
81
82
- count , err = personDao .Create (ctx , wrapper , "Julia" , 32 )
82
+ _ , err = personDao .Create (ctx , wrapper , "Julia" , 32 )
83
83
if err != nil {
84
84
b .Fatalf ("create 3 failed: %v" , err )
85
85
}
86
86
87
- count , err = personDao .Create (ctx , wrapper , "Pat" , 37 )
87
+ _ , err = personDao .Create (ctx , wrapper , "Pat" , 37 )
88
88
if err != nil {
89
89
b .Fatalf ("create 4 failed: %v" , err )
90
90
}
91
91
92
- person , err : = personDao .Get (ctx , wrapper , 1 )
92
+ _ , err = personDao .Get (ctx , wrapper , 1 )
93
93
if err != nil {
94
94
b .Fatalf ("get failed: %v" , err )
95
95
}
96
96
97
- people , err : = personDao .GetAll (ctx , wrapper )
97
+ _ , err = personDao .GetAll (ctx , wrapper )
98
98
if err != nil {
99
99
b .Fatalf ("get all failed: %v" , err )
100
100
}
101
101
102
- people , err = personDao .GetByAge (ctx , wrapper , 1 , []int {20 , 32 }, "Fred" )
102
+ people , err : = personDao .GetByAge (ctx , wrapper , 1 , []int {20 , 32 }, "Fred" )
103
103
if err != nil {
104
104
b .Fatalf ("get by age failed: %v" , err )
105
105
}
106
106
107
- count , err = personDao .Update (ctx , wrapper , 1 , "Freddie" , 30 )
107
+ _ , err = personDao .Update (ctx , wrapper , 1 , "Freddie" , 30 )
108
108
if err != nil {
109
109
b .Fatalf ("update failed: %v" , err )
110
110
}
111
111
112
- person , err = personDao .Get (ctx , wrapper , 1 )
112
+ _ , err = personDao .Get (ctx , wrapper , 1 )
113
113
if err != nil {
114
114
b .Fatalf ("get 2 failed: %v" , err )
115
115
}
116
116
117
- count , err = personDao .Delete (ctx , wrapper , 1 )
117
+ _ , err = personDao .Delete (ctx , wrapper , 1 )
118
118
if err != nil {
119
119
b .Fatalf ("delete failed: %v" , err )
120
120
}
121
121
122
- count , err = personDao .Delete (ctx , wrapper , 1 )
122
+ count , err : = personDao .Delete (ctx , wrapper , 1 )
123
123
if err != nil {
124
124
b .Fatalf ("delete 2 failed: %v" , err )
125
125
}
126
126
127
- person , err = personDao .Get (ctx , wrapper , 1 )
127
+ person , err : = personDao .Get (ctx , wrapper , 1 )
128
128
if err != nil {
129
129
b .Fatalf ("get 3 failed: %v" , err )
130
130
}
@@ -145,7 +145,7 @@ func BenchmarkStandard(b *testing.B) {
145
145
146
146
type standardPersonDao struct {}
147
147
148
- // `proq:"INSERT INTO PERSON(name, age) VALUES(:name:, :age:)" prop:"name,age"`
148
+ // `proq:"INSERT INTO PERSON(name, age) VALUES(:name:, :age:)" prop:"name,age"`
149
149
func (spd standardPersonDao ) Create (db * sql.DB , name string , age int ) (int64 , error ) {
150
150
result , err := db .Exec ("INSERT INTO PERSON(name, age) VALUES($1, $2)" , name , age )
151
151
if err != nil {
@@ -155,7 +155,7 @@ func (spd standardPersonDao) Create(db *sql.DB, name string, age int) (int64, er
155
155
return count , err
156
156
}
157
157
158
- //`proq:"SELECT * FROM PERSON WHERE id = :id:" prop:"id"`
158
+ // `proq:"SELECT * FROM PERSON WHERE id = :id:" prop:"id"`
159
159
func (spd standardPersonDao ) Get (db * sql.DB , id int ) (* Person , error ) {
160
160
rows , err := db .Query ("SELECT age, name, id FROM PERSON WHERE id = $1" , id )
161
161
if err != nil {
@@ -173,7 +173,7 @@ func (spd standardPersonDao) Get(db *sql.DB, id int) (*Person, error) {
173
173
return p , err
174
174
}
175
175
176
- //`proq:"UPDATE PERSON SET name = :name:, age=:age: where id=:id:" prop:"id,name,age"`
176
+ // `proq:"UPDATE PERSON SET name = :name:, age=:age: where id=:id:" prop:"id,name,age"`
177
177
func (spd standardPersonDao ) Update (db * sql.DB , id int , name string , age int ) (int64 , error ) {
178
178
result , err := db .Exec ("UPDATE PERSON SET name = $1, age=$2 where id=$3" , name , age , id )
179
179
if err != nil {
@@ -183,7 +183,7 @@ func (spd standardPersonDao) Update(db *sql.DB, id int, name string, age int) (i
183
183
return count , err
184
184
}
185
185
186
- //`proq:"DELETE FROM PERSON WHERE id = :id:" prop:"id"`
186
+ // `proq:"DELETE FROM PERSON WHERE id = :id:" prop:"id"`
187
187
func (spd standardPersonDao ) Delete (db * sql.DB , id int ) (int64 , error ) {
188
188
result , err := db .Exec ("DELETE FROM PERSON WHERE id = $1" , id )
189
189
if err != nil {
@@ -193,7 +193,7 @@ func (spd standardPersonDao) Delete(db *sql.DB, id int) (int64, error) {
193
193
return count , err
194
194
}
195
195
196
- //`proq:"SELECT * FROM PERSON"`
196
+ // `proq:"SELECT * FROM PERSON"`
197
197
func (spd standardPersonDao ) GetAll (db * sql.DB ) ([]Person , error ) {
198
198
rows , err := db .Query ("SELECT age, name, id FROM PERSON" )
199
199
if err != nil {
@@ -216,7 +216,7 @@ func (spd standardPersonDao) GetAll(db *sql.DB) ([]Person, error) {
216
216
return out , err
217
217
}
218
218
219
- //`proq:"SELECT * from PERSON WHERE name=:name: and age in (:ages:) and id = :id:" prop:"id,ages,name"`
219
+ // `proq:"SELECT * from PERSON WHERE name=:name: and age in (:ages:) and id = :id:" prop:"id,ages,name"`
220
220
func (spd standardPersonDao ) GetByAge (db * sql.DB , id int , ages []int , name string ) ([]Person , error ) {
221
221
startQuery := "SELECT age, name, id from PERSON WHERE name=$1 and age in (:ages:) and id = :id:"
222
222
params := make ([]string , len (ages ))
@@ -260,62 +260,62 @@ func (spd standardPersonDao) GetByAge(db *sql.DB, id int, ages []int, name strin
260
260
var sPersonDao = standardPersonDao {}
261
261
262
262
func doPersonStuffForStandardTest (b * testing.B , db * sql.DB ) (int64 , * Person , []Person , error ) {
263
- count , err := sPersonDao .Create (db , "Fred" , 20 )
263
+ _ , err := sPersonDao .Create (db , "Fred" , 20 )
264
264
if err != nil {
265
265
b .Fatalf ("create failed: %v" , err )
266
266
}
267
267
268
- count , err = sPersonDao .Create (db , "Bob" , 50 )
268
+ _ , err = sPersonDao .Create (db , "Bob" , 50 )
269
269
if err != nil {
270
270
b .Fatalf ("create 2 failed: %v" , err )
271
271
}
272
272
273
- count , err = sPersonDao .Create (db , "Julia" , 32 )
273
+ _ , err = sPersonDao .Create (db , "Julia" , 32 )
274
274
if err != nil {
275
275
b .Fatalf ("create 3 failed: %v" , err )
276
276
}
277
277
278
- count , err = sPersonDao .Create (db , "Pat" , 37 )
278
+ _ , err = sPersonDao .Create (db , "Pat" , 37 )
279
279
if err != nil {
280
280
b .Fatalf ("create 4 failed: %v" , err )
281
281
}
282
282
283
- person , err : = sPersonDao .Get (db , 1 )
283
+ _ , err = sPersonDao .Get (db , 1 )
284
284
if err != nil {
285
285
b .Fatalf ("get failed: %v" , err )
286
286
}
287
287
288
- people , err : = sPersonDao .GetAll (db )
288
+ _ , err = sPersonDao .GetAll (db )
289
289
if err != nil {
290
290
b .Fatalf ("get all failed: %v" , err )
291
291
}
292
292
293
- people , err = sPersonDao .GetByAge (db , 1 , []int {20 , 32 }, "Fred" )
293
+ people , err : = sPersonDao .GetByAge (db , 1 , []int {20 , 32 }, "Fred" )
294
294
if err != nil {
295
295
b .Fatalf ("get by age failed: %v" , err )
296
296
}
297
297
298
- count , err = sPersonDao .Update (db , 1 , "Freddie" , 30 )
298
+ _ , err = sPersonDao .Update (db , 1 , "Freddie" , 30 )
299
299
if err != nil {
300
300
b .Fatalf ("update failed: %v" , err )
301
301
}
302
302
303
- person , err = sPersonDao .Get (db , 1 )
303
+ _ , err = sPersonDao .Get (db , 1 )
304
304
if err != nil {
305
305
b .Fatalf ("get 2 failed: %v" , err )
306
306
}
307
307
308
- count , err = sPersonDao .Delete (db , 1 )
308
+ _ , err = sPersonDao .Delete (db , 1 )
309
309
if err != nil {
310
310
b .Fatalf ("delete failed: %v" , err )
311
311
}
312
312
313
- count , err = sPersonDao .Delete (db , 1 )
313
+ count , err : = sPersonDao .Delete (db , 1 )
314
314
if err != nil {
315
315
b .Fatalf ("delete 2 failed: %v" , err )
316
316
}
317
317
318
- person , err = sPersonDao .Get (db , 1 )
318
+ person , err : = sPersonDao .Get (db , 1 )
319
319
if err != nil {
320
320
b .Fatalf ("get 3 failed: %v" , err )
321
321
}
0 commit comments