Skip to content

Commit

Permalink
Merge branch 'main' into feat-930-browse-stored-webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain authored Aug 26, 2024
2 parents 59266d8 + 524c725 commit 65239c9
Show file tree
Hide file tree
Showing 3 changed files with 500 additions and 107 deletions.
23 changes: 12 additions & 11 deletions internal/query/gin_map.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package query

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

// QueryNestedMap returns a map for a given query key.
//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.
//
//revive:disable:exported We want to mimic the gin API
func QueryNestedMap(c *gin.Context, key string) (dicts map[string]interface{}) {
dicts, _ = GetQueryNestedMap(c, key)
return
func ShouldGetQueryNestedMap(c *gin.Context) (dict map[string]any, err error) {
return ShouldGetQueryNestedMapForKey(c, "")
}

// GetQueryNestedMap returns a map for a given query key, plus a boolean value
// whether at least one value exists for the given key.
// In contrast to GetQueryMap it handles nesting in query maps like key[foo][bar]=value.
func GetQueryNestedMap(c *gin.Context, key string) (map[string]interface{}, bool) {
// 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) (dict map[string]any, err error) {
q := c.Request.URL.Query()
return GetMap(q, key)
}
Expand Down
Loading

0 comments on commit 65239c9

Please sign in to comment.