Cover nil panic when the filter doesn't define any constraints
The RDBMS/dal SQL builder merged model-defined constraints and filter defined constraints. Now that model-defined constraints are no longer guaranteed, it was panicing.
This commit is contained in:
@@ -255,9 +255,13 @@ func (d *model) searchSql(f filter.Filter) *goqu.SelectDataset {
|
||||
|
||||
cc := f.Constraints()
|
||||
if d.model.Constraints != nil {
|
||||
for k, c := range d.model.Constraints {
|
||||
// Overwrite user-provided constraints as the system ones are more important
|
||||
cc[k] = c
|
||||
if cc == nil {
|
||||
cc = d.model.Constraints
|
||||
} else {
|
||||
for k, c := range d.model.Constraints {
|
||||
// Overwrite user-provided constraints as the system ones are more important
|
||||
cc[k] = c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user