niki/pkg/query_param/echo.go

19 lines
363 B
Go

package queryparam
import (
"strings"
"github.com/labstack/echo/v4"
)
func GetFilterParams(c echo.Context) map[string]any {
queryParams := make(map[string]any)
for key, values := range c.QueryParams() {
if len(values) > 0 && strings.HasPrefix(key, "filter_") {
queryParams[strings.TrimPrefix(key, "filter_")] = values[0]
}
}
return queryParams
}