-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Refactor value verification to manage bools. #5008
Refactor value verification to manage bools. #5008
Conversation
Strings are still dropped, bools are set to 1 for true and 0 for false Solves: influxdata#5006
case bool: | ||
if field.Value == bool(true) { | ||
// Store 1 for a "true" value | ||
field.Value = 1 |
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.
Can you change this to copy to a local? I'm planning to change around FieldList() to prevent modification this way, it will give more predictable behavior during retries and harder to use the type incorrectly.
Might be easiest to rename verifyValue
and have it return a value + bool so we don't have to switch twice:
func convertValue(v interface{}) (interface{}, bool)
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.
went back to having it called verifyValue() but I believe I implemented it in a fashion compatible with your request.
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.
(I don't know what the protocol is for who should resolve the conversation)
Move value type verification and modification back to a function store value modifications in a local. Remove a bit of duplicate work.
(cherry picked from commit 85ee354)
Strings are still dropped, bools are set to 1 for true and 0 for false
closes: #5006
Required for all PRs: