-
Notifications
You must be signed in to change notification settings - Fork 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
chore: upgrade momento sdk - consistency, less copypasta #150
Conversation
This change establishes a common pattern for interacting with the service. Rather than copy/pasting matches, MomentoError -> CliError mapping and json dump code around, this names those functionalities as functions: * interact_with_momento: Completes a momento future and maps the result to a Result< HappyCaseType, CliError > * print_whatever_this_is_as_json: prints whatever you feed it as json There are small changes to debug and error messages, but this change should cause no functional changes.
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.
Minor comment, everything else looks good. Thank you for helping reduce our copy-pasta code, this is super clean
pub fn print_whatever_this_is_as_json<T>(value: &T) | ||
where | ||
T: serde::Serialize, | ||
{ | ||
println!( | ||
"{}", | ||
serde_json::to_string_pretty(value).expect("Could not print whatever this is as json") | ||
); | ||
} |
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.
Minor nit: I like having a function that uses generics to pretty print results, could we name it to something more streamlined like print_as_json
? print_whatever_this_is
almost seems a little tongue-in-cheek for a public-vended CLI
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.
Sure, I'll remove this tiny island of joy from the sea of dispassion. I still need to look into windows too.
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.
nice cleanup, ty
converted to draft because I need to mess with the github workflow to make windows work. I don't know why it can't find cmake. |
…ithub windows server 2022 runner
also choco install protoc in a windows build near you
Integration tests are broken for unrelated reasons. |
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.
This change establishes a common pattern for interacting with the
service. Rather than copy/pasting matches, MomentoError -> CliError
mapping and json dump code around, this names those functionalities
as functions:
result to a Result< HappyCaseType, CliError >
This change was precipitated by the change in the SDK to simplify
and coalesce client creation behind the SimpleCacheClientBuilder and
triggered by the SDK upgrade.
There are small changes to debug and error messages, but this change
should cause no functional changes.
tired of copypasta.
becomes