-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: change record filter behaviour (#23)
* feat(search)!: change filter behaviour * feat!: change filter behaviour when fetching records
- Loading branch information
1 parent
6eff531
commit 580aa5f
Showing
14 changed files
with
170 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package handlers | ||
|
||
import ( | ||
"net/url" | ||
"strings" | ||
) | ||
|
||
func filterConfigFromValues(querystring url.Values) map[string][]string { | ||
var filter = make(map[string][]string) | ||
for key, values := range querystring { | ||
// filters are of form "filter.{field}", apart from "filter.type", which is used | ||
// for building the type whitelist. | ||
if !strings.HasPrefix(key, filterPrefix) || strings.EqualFold(key, whiteListQueryParamKey) { | ||
continue | ||
} | ||
|
||
var filterValues []string | ||
for _, value := range values { | ||
for _, v := range strings.Split(value, ",") { | ||
filterValues = append(filterValues, v) | ||
} | ||
} | ||
|
||
filterKey := strings.TrimPrefix(key, filterPrefix) | ||
filter[filterKey] = filterValues | ||
} | ||
return filter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.