-
Notifications
You must be signed in to change notification settings - Fork 155
feat: decimal format #1494
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
feat: decimal format #1494
Conversation
d53c3bc to
4ce54f3
Compare
| return typePrefix("UnixMicro") | ||
| case "unix-milli": | ||
| return typePrefix("UnixMilli") | ||
| case "decimal": //nolint:goconst // This whole switch is duplicated in NamePostfix. Should create a common helper. |
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.
See code comment. Will clean up to remove duplication of this switch in a separate PR. Just didn't want to pollute this one too much.
If you don't mind unrelated refactor going in this feature I can fix it on this PR though.
| // SetExclusiveMinimum sets exclusive minimum value. | ||
| func (t *Decimal) SetExclusiveMinimum(v decimal.Decimal) { | ||
| t.MinExclusive = true | ||
| t.SetMinimum(v) | ||
| } | ||
|
|
||
| // SetExclusiveMaximum sets exclusive maximum value. | ||
| func (t *Decimal) SetExclusiveMaximum(v decimal.Decimal) { | ||
| t.MaxExclusive = true | ||
| t.SetMaximum(v) | ||
| } |
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 included these to match the float validator, although they actually aren't used anywhere (neither here nor float). Shall I remove?
|
Hey @abemedia, please resolve conflicts |
4ce54f3 to
29a7e27
Compare
|
@ernado I have resolved conflicts. |
Add support for
format: decimalfor typesnumberandstringusing https://github.com/shopspring/decimal (the most widely used Go package for decimals, see https://pkg.go.dev/search?q=decimal).Closes #1478