Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/func-to-parse-qu…
Browse files Browse the repository at this point in the history
…ery-params

# Conflicts:
#	internal/query/gin_map.go
#	internal/query/gin_map_test.go
#	internal/query/map.go
  • Loading branch information
dorzepowski committed Aug 26, 2024
2 parents ac2d184 + 524c725 commit e4f89c4
Show file tree
Hide file tree
Showing 3 changed files with 270 additions and 85 deletions.
8 changes: 5 additions & 3 deletions internal/query/gin_map.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package query

import "github.com/gin-gonic/gin"
import (
"github.com/gin-gonic/gin"
)

//revive:disable:exported We want to mimic the gin API.

// ShouldGetQueryNestedMap returns a map from query params.
// In contrast to QueryMap it handles nesting in query maps like key[foo][bar]=value.
func ShouldGetQueryNestedMap(c *gin.Context) (dicts map[string]interface{}, err error) {
func ShouldGetQueryNestedMap(c *gin.Context) (dict map[string]any, err error) {
return ShouldGetQueryNestedMapForKey(c, "")
}

// ShouldGetQueryNestedMapForKey returns a map from query params for a given query key.
// In contrast to QueryMap it handles nesting in query maps like key[foo][bar]=value.
// Similar to ShouldGetQueryNestedMap but it returns only the map for the given key.
func ShouldGetQueryNestedMapForKey(c *gin.Context, key string) (dicts map[string]interface{}, err error) {
func ShouldGetQueryNestedMapForKey(c *gin.Context, key string) (dict map[string]any, err error) {
q := c.Request.URL.Query()
return GetMap(q, key)
}
Expand Down
Loading

0 comments on commit e4f89c4

Please sign in to comment.