chore: upgrade momento sdk - consistency, less copypasta#150
Merged
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.
Contributor
tylerburdsall
left a comment
There was a problem hiding this comment.
Minor comment, everything else looks good. Thank you for helping reduce our copy-pasta code, this is super clean
Comment on lines
+26
to
+34
| 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") | ||
| ); | ||
| } |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
Sure, I'll remove this tiny island of joy from the sea of dispassion. I still need to look into windows too.
Contributor
Author
|
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
Contributor
Author
|
Integration tests are broken for unrelated reasons. |
cprice404
approved these changes
May 21, 2022
tylerburdsall
approved these changes
May 21, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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