Allow null query mods for dynamic queries
This commit is contained in:
parent
e3fe976c3c
commit
c01b182839
1 changed files with 4 additions and 3 deletions
|
@ -8,9 +8,11 @@ type QueryMod func(q *queries.Query)
|
||||||
// Apply the query mods to the Query object
|
// Apply the query mods to the Query object
|
||||||
func Apply(q *queries.Query, mods ...QueryMod) {
|
func Apply(q *queries.Query, mods ...QueryMod) {
|
||||||
for _, mod := range mods {
|
for _, mod := range mods {
|
||||||
|
if mod != nil {
|
||||||
mod(q)
|
mod(q)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SQL allows you to execute a plain SQL statement
|
// SQL allows you to execute a plain SQL statement
|
||||||
func SQL(sql string, args ...interface{}) QueryMod {
|
func SQL(sql string, args ...interface{}) QueryMod {
|
||||||
|
@ -129,7 +131,6 @@ func ForceIndex( index string) QueryMod {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Limit the number of returned rows
|
// Limit the number of returned rows
|
||||||
func Limit(limit int) QueryMod {
|
func Limit(limit int) QueryMod {
|
||||||
return func(q *queries.Query) {
|
return func(q *queries.Query) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue