Skip to content

feat: support write method #26

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 1 commit into from
Aug 12, 2024
Merged

feat: support write method #26

merged 1 commit into from
Aug 12, 2024

Conversation

hiiiik
Copy link
Contributor

@hiiiik hiiiik commented Aug 11, 2024

No description provided.

@hiiiik hiiiik force-pushed the write branch 5 times, most recently from be286f5 to 3ed3377 Compare August 11, 2024 16:09
std::string LineProtocolEncoder::Encode(const std::vector<Point>& points)
{
if (points.empty()) {
throw Exception(errc::LogicErrors::InvalidArgument,
Copy link
Member

Choose a reason for hiding this comment

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

This should be sync with other languages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we allow user to pass an empty vector of points that the library will neither throw an exception nor invoke any request to server for it.

}
else if constexpr (std::is_same_v<T, double>) {
Append(innerValue);
}
Copy link
Member

Choose a reason for hiding this comment

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

shoud we add a default error? like

else {
    static_assert(always_false<T>::value, "Unhandled type in std::variant.");
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good advice, I will add a runtime checking in the else branch.

@hezhangjian hezhangjian merged commit da0de1a into openGemini:main Aug 12, 2024
5 checks passed
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.

2 participants