From 89c72e04bb19e68cd2d3f7cf46004938a53dc66f Mon Sep 17 00:00:00 2001 From: Emilia Grant Date: Thu, 15 Jan 2026 09:29:28 -0500 Subject: [PATCH] add comments to parsing functions --- internal/clientcache/internal/daemon/search_handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/clientcache/internal/daemon/search_handler.go b/internal/clientcache/internal/daemon/search_handler.go index cd955f84f9..2ea3fac8d6 100644 --- a/internal/clientcache/internal/daemon/search_handler.go +++ b/internal/clientcache/internal/daemon/search_handler.go @@ -259,6 +259,8 @@ func writeUnsupportedError(w http.ResponseWriter) { http.Error(w, string(b), http.StatusBadRequest) } +// Parses a raw sort direction string into a cache.SortDirection +// Returns the sort direction and whether the provided direction was valid or not func parseSortDirection(sd string) (cache.SortDirection, bool) { sd = strings.ToLower(sd) switch sd { @@ -273,6 +275,8 @@ func parseSortDirection(sd string) (cache.SortDirection, bool) { } } +// Parses a raw column name to sort by into a cache.SortBy +// Returns the column to sort by and whether the provided column was valid or not func parseSortBy(sb string, sr cache.SearchableResource) (cache.SortBy, bool) { sb = strings.ToLower(sb) by := cache.SortBy(sb)