MCPcopy Create free account
hub / github.com/kataras/iris / URLParamsSorted

Method URLParamsSorted

context/context.go:1723–1747  ·  view source on GitHub ↗

URLParamsSorted returns a sorted (by key) slice of key-value entries of the URL Query parameters.

()

Source from the content-addressed store, hash-verified

1721// URLParamsSorted returns a sorted (by key) slice
1722// of key-value entries of the URL Query parameters.
1723func (ctx *Context) URLParamsSorted() []memstore.StringEntry {
1724 q := ctx.getQuery()
1725 n := len(q)
1726 if n == 0 {
1727 return nil
1728 }
1729
1730 keys := make([]string, 0, n)
1731 for key := range q {
1732 keys = append(keys, key)
1733 }
1734
1735 sort.Strings(keys)
1736
1737 entries := make([]memstore.StringEntry, 0, n)
1738 for _, key := range keys {
1739 value := q[key]
1740 entries = append(entries, memstore.StringEntry{
1741 Key: key,
1742 Value: strings.Join(value, ","),
1743 })
1744 }
1745
1746 return entries
1747}
1748
1749// ResetQuery clears the GET URL Query request, temporary, cache.
1750// Any new URLParamXXX calls will receive the new parsed values.

Callers 1

afterMethod · 0.80

Calls 1

getQueryMethod · 0.95

Tested by

no test coverage detected