-
Notifications
You must be signed in to change notification settings - Fork 80
feat: Impl Transform::ToHumanString #505
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
base: main
Are you sure you want to change the base?
Conversation
| Result<std::unique_ptr<UnboundPredicate>> ProjectStrict( | ||
| std::string_view name, const std::shared_ptr<BoundPredicate>& predicate); | ||
|
|
||
| /// \brief Returns a human-readable String representation of a transformed value. |
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.
| /// \brief Returns a human-readable String representation of a transformed value. | |
| /// \brief Returns a human-readable string representation of a transformed value. |
| /// \brief Returns a human-readable String representation of a transformed value. | ||
| /// | ||
| /// \param value The literal value to be transformed. | ||
| /// \return A human-readable String representation of the value |
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.
| /// \return A human-readable String representation of the value | |
| /// \return A human-readable string representation of the value |
| } | ||
|
|
||
| Result<std::string> Transform::ToHumanString(const Literal& value) { | ||
| if (value.IsNull()) { |
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.
Let's return error when IsAboveMax() or IsBelowMin() is true.
|
|
||
| switch (transform_type_) { | ||
| case TransformType::kYear: | ||
| return TransformUtil::HumanYear(std::get<int32_t>(value.value())); |
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.
We might need to check the literal type before calling std::get on the variant value to avoid exception.
| return TransformUtil::HumanDay(std::get<int32_t>(value.value())); | ||
| case TransformType::kHour: | ||
| return TransformUtil::HumanHour(std::get<int32_t>(value.value())); | ||
| default: { |
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 we remove this default and add all other branches explicitly to avoid forgetting to update here in the future once we add a new transform type?
No description provided.