Skip to content
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

WithUnknownValue to treat unknown values as a non-error #24

Merged
merged 1 commit into from Nov 3, 2021

Conversation

mitchellh
Copy link
Contributor

This introduces a new option "WithUnknownValue" that can be used to
specify some value to use for unknown keys. Normally, bexpr will error
(and this continues to be the default). However, an alternate zero value
behavior can be specified to use that instead.

This is useful for situations where you want to treat empty values as
say... empty string so that an expression generally fails but with a
false rather than an error.

This also updates to pointerstructure 1.2.1 which fixes on "not found"
case that wasn't wrapping ErrNotFound properly.

Copy link
Member

@mkeeler mkeeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This introduces a new option "WithUnknownValue" that can be used to
specify some value to use for unknown keys. Normally, bexpr will error
(and this continues to be the default). However, an alternate zero value
behavior can be specified to use that instead.

This is useful for situations where you want to treat empty values as
say... empty string so that an expression generally fails but with a
false rather than an error.

This also updates to pointerstructure 1.2.1 which fixes on "not found"
case that wasn't wrapping ErrNotFound properly.
@mitchellh mitchellh merged commit 9ef6478 into main Nov 3, 2021
@mitchellh mitchellh deleted the feature/unknownval branch November 3, 2021 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants