Allow null query mods for dynamic queries #7

Merged
tiger5226 merged 1 commit from guard_null_mod into master 2019-07-02 05:56:28 +02:00

View file

@ -8,9 +8,11 @@ type QueryMod func(q *queries.Query)
// Apply the query mods to the Query object
func Apply(q *queries.Query, mods ...QueryMod) {
for _, mod := range mods {
if mod != nil {
mod(q)
}
}
}
// SQL allows you to execute a plain SQL statement
func SQL(sql string, args ...interface{}) QueryMod {
@ -129,7 +131,6 @@ func ForceIndex( index string) QueryMod {
}
}
// Limit the number of returned rows
func Limit(limit int) QueryMod {
return func(q *queries.Query) {