@@ -30,22 +30,23 @@ type Query struct {
30
30
load []string
31
31
loadMods map [string ]Applicator
32
32
33
- delete bool
34
- update map [string ]interface {}
35
- withs []argClause
36
- selectCols []string
37
- count bool
38
- from []string
39
- joins []join
40
- where []where
41
- groupBy []string
42
- orderBy []argClause
43
- having []argClause
44
- limit * int
45
- offset int
46
- forlock string
47
- distinct string
48
- comment string
33
+ delete bool
34
+ update map [string ]interface {}
35
+ withs []argClause
36
+ optimizerHints []string
37
+ selectCols []string
38
+ count bool
39
+ from []string
40
+ joins []join
41
+ where []where
42
+ groupBy []string
43
+ orderBy []argClause
44
+ having []argClause
45
+ limit * int
46
+ offset int
47
+ forlock string
48
+ distinct string
49
+ comment string
49
50
50
51
// This field is a hack to allow a query to strip out the reference
51
52
// to deleted at is null.
@@ -246,6 +247,16 @@ func GetSelect(q *Query) []string {
246
247
return q .selectCols
247
248
}
248
249
250
+ // SetOptimizerHints on the query.
251
+ func SetOptimizerHints (q * Query , optimizerHints []string ) {
252
+ q .optimizerHints = optimizerHints
253
+ }
254
+
255
+ // GetOptimizerHints from the query
256
+ func GetOptimizerHints (q * Query ) []string {
257
+ return q .optimizerHints
258
+ }
259
+
249
260
// SetDistinct on the query.
250
261
func SetDistinct (q * Query , distinct string ) {
251
262
q .distinct = distinct
@@ -291,6 +302,11 @@ func AppendSelect(q *Query, columns ...string) {
291
302
q .selectCols = append (q .selectCols , columns ... )
292
303
}
293
304
305
+ // AppendOptimizerHint on the query.
306
+ func AppendOptimizerHint (q * Query , optimizerHint string , args ... interface {}) {
307
+ q .optimizerHints = append (q .optimizerHints , fmt .Sprintf (optimizerHint , args ... ))
308
+ }
309
+
294
310
// AppendFrom on the query.
295
311
func AppendFrom (q * Query , from ... string ) {
296
312
q .from = append (q .from , from ... )
0 commit comments