Skip to content

Allow Boolean encoding to be governed by new BoolEncodingStrategy #10

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

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

scottmatthewman
Copy link
Owner

Booleans can now be formatted in one of several ways:

  • true/false
  • TRUE/FALSE
  • yes/no
  • YES/NO
  • 1/0
  • with custom true/false strings

This is governed by a new strategy added to CSVEncoderConfiguration. The default is .trueFalse, which is the same as the previous hardcoded encoding.

Closes #2.

This adds support for encoding boolean values in a variety of ways:

- true/false (the default)
- TRUE/FALSE
- yes/no
- YES/NO
- 1/0
- Custom user-supplied strings
Rather than having a switch statement with identical ternary checks,
move the true/false values to be computed properties on the strategy
enum, which then simplifies the encode function.
@scottmatthewman scottmatthewman merged commit d810868 into main Jan 3, 2024
@scottmatthewman scottmatthewman deleted the boolean-encoding branch January 3, 2024 19:27
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.

Add a configuration strategy for Boolean encoding
1 participant