-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP feat: add option sets whether reset args when reset #1059
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,8 +63,13 @@ type argsScanner struct { | |
type Args struct { | ||
noCopy nocopy.NoCopy //lint:ignore U1000 until noCopy is used | ||
|
||
args []argsKV | ||
buf []byte | ||
args []argsKV | ||
buf []byte | ||
reuse bool | ||
} | ||
|
||
func (a *Args) SetReuseArgs(b bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里不需要 |
||
a.reuse = b | ||
} | ||
|
||
// Set sets 'key=value' argument. | ||
|
@@ -74,6 +79,9 @@ func (a *Args) Set(key, value string) { | |
|
||
// Reset clears query args. | ||
func (a *Args) Reset() { | ||
if a.reuse { | ||
a.args = []argsKV{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里不需要 |
||
} | ||
a.args = a.args[:0] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 允许自定义 Reset 函数的行为即可 |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要