diff --git a/internal/clientcache/internal/cache/search.go b/internal/clientcache/internal/cache/search.go index 3e9e1bb0b7..97f0253ea3 100644 --- a/internal/clientcache/internal/cache/search.go +++ b/internal/clientcache/internal/cache/search.go @@ -25,6 +25,15 @@ const ( SortByCreatedAt SortBy = "created_at" ) +// Valid returns true if the SortBy value is a known good value +func (s SortBy) Valid() bool { + switch s { + case SortByDefault, SortByName, SortByCreatedAt: + return true + } + return false +} + type SortDirection string const ( @@ -33,6 +42,15 @@ const ( Descending SortDirection = "desc" ) +// Valid returns true if the SortDirection value is a known good value +func (d SortDirection) Valid() bool { + switch d { + case SortDirectionDefault, Ascending, Descending: + return true + } + return false +} + type SearchableResource string const (