Skip to content

Commit 3f035a9

Browse files
authored
Merge pull request #7 from lbryio/guard_null_mod
Allow null query mods for dynamic queries
2 parents e3fe976 + c01b182 commit 3f035a9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

queries/qm/query_mods.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ type QueryMod func(q *queries.Query)
88
// Apply the query mods to the Query object
99
func Apply(q *queries.Query, mods ...QueryMod) {
1010
for _, mod := range mods {
11-
mod(q)
11+
if mod != nil {
12+
mod(q)
13+
}
1214
}
1315
}
1416

@@ -123,13 +125,12 @@ func From(from string) QueryMod {
123125
}
124126
}
125127

126-
func ForceIndex( index string) QueryMod {
128+
func ForceIndex(index string) QueryMod {
127129
return func(q *queries.Query) {
128130
queries.SetForceIndex(q, index)
129131
}
130132
}
131133

132-
133134
// Limit the number of returned rows
134135
func Limit(limit int) QueryMod {
135136
return func(q *queries.Query) {

0 commit comments

Comments
 (0)