aboutsummaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2016-02-15 14:01:22 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2016-02-15 14:01:22 +0200
commitdb0b8124a5b5a5671ec67eef75e4288461f5d0c9 (patch)
tree9de71ad3a9d28b0ba0810383f07ad4953a67384e /args.go
parentDo not copy body stream in Request.CopyTo to be consistent with Response.CopyTo (diff)
downloadfasthttp-db0b8124a5b5a5671ec67eef75e4288461f5d0c9.tar.gz
fasthttp-db0b8124a5b5a5671ec67eef75e4288461f5d0c9.tar.bz2
fasthttp-db0b8124a5b5a5671ec67eef75e4288461f5d0c9.zip
Added Args.PeekMulti for obtaining multiple query arg values for the given key
Diffstat (limited to 'args.go')
-rw-r--r--args.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/args.go b/args.go
index a3ad40d..8e36ae1 100644
--- a/args.go
+++ b/args.go
@@ -156,6 +156,22 @@ func (a *Args) PeekBytes(key []byte) []byte {
return peekArgBytes(a.args, key)
}
+// PeekMulti returns all the arg values for the given key.
+func (a *Args) PeekMulti(key string) [][]byte {
+ var values [][]byte
+ a.VisitAll(func(k, v []byte) {
+ if string(k) == key {
+ values = append(values, v)
+ }
+ })
+ return values
+}
+
+// PeekMultiBytes returns all the arg values for the given key.
+func (a *Args) PeekMultiBytes(key []byte) [][]byte {
+ return a.PeekMulti(unsafeBytesToStr(key))
+}
+
// Has returns true if the given key exists in Args.
func (a *Args) Has(key string) bool {
a.bufKV.key = append(a.bufKV.key[:0], key...)