Better detection of ID fields, to use = instead of LIKE

This commit is contained in:
Deluan 2020-11-15 18:24:13 -05:00 committed by Joe Stump
parent 29c939cd3e
commit 81b1e1bbad
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -26,7 +26,7 @@ func (r sqlRestful) parseRestFilters(options rest.QueryOptions) Sqlizer {
}
if ff, ok := r.filterMappings[f]; ok {
filters = append(filters, ff(f, v))
} else if f == "id" {
} else if strings.HasSuffix(strings.ToLower(f), "id") {
filters = append(filters, eqFilter(f, v))
} else {
filters = append(filters, startsWithFilter(f, v))