aboutsummaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-10-01 13:37:28 +0200
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-10-01 13:38:31 +0200
commitffab77a59d9ca1fe3add2f6501efd44a6669291b (patch)
treeaaf7a9f715cd1f5f813f2efbae1479628a18e7bc /args.go
parentProperly parse URI (diff)
downloadfasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.gz
fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.bz2
fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.zip
Improve return value reusability documentation
Diffstat (limited to 'args.go')
-rw-r--r--args.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/args.go b/args.go
index 07600f9..a6db223 100644
--- a/args.go
+++ b/args.go
@@ -110,7 +110,8 @@ func (a *Args) String() string {
// QueryString returns query string for the args.
//
-// The returned value is valid until the next call to Args methods.
+// The returned value is valid until the Args is reused or released (ReleaseArgs).
+// Do not store references to the returned value. Make copies instead.
func (a *Args) QueryString() []byte {
a.buf = a.AppendBytes(a.buf[:0])
return a.buf
@@ -241,14 +242,16 @@ func (a *Args) SetBytesKNoValue(key []byte) {
// Peek returns query arg value for the given key.
//
-// Returned value is valid until the next Args call.
+// The returned value is valid until the Args is reused or released (ReleaseArgs).
+// Do not store references to the returned value. Make copies instead.
func (a *Args) Peek(key string) []byte {
return peekArgStr(a.args, key)
}
// PeekBytes returns query arg value for the given key.
//
-// Returned value is valid until the next Args call.
+// The returned value is valid until the Args is reused or released (ReleaseArgs).
+// Do not store references to the returned value. Make copies instead.
func (a *Args) PeekBytes(key []byte) []byte {
return peekArgBytes(a.args, key)
}