-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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(textual): Value Renderers for numbers #12088
Conversation
types/textual/valuerenderer.go
Outdated
@@ -0,0 +1,177 @@ | |||
package textual |
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.
@aaronc With the new app wiring, where should this package go? Will we have a root tx/
go mod?
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.
Generally looks like the right direction. Let's switch to a more efficient Reader/Writer implementation. We may want to pre-calculate buffer sizes like the orm does
// here, so that optionally more value renderers could be built, for example, a | ||
// separate one for a different language. | ||
type ValueRenderer interface { | ||
Format(context.Context, protoreflect.Value) ([]string, error) |
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.
Format(context.Context, protoreflect.Value) ([]string, error) | |
Format(context.Context, protoreflect.Value, io.Writer) error |
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 guess the downside is that value renderers would need to deal with \n
chars all over. By keeping []string
we can just do a single .Join()
at the very end.
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.
Do they need to deal with new lines actually? Shouldn't that be dealt with higher up?
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.
For when the FieldDescriptor is a message field, there'll be new lines (in a future PR).
OK I changed to io.Reader/Writer in dbe153b. I still think |
Not seeing where there's a new line issue |
OK, this is R4R again, and uses the new |
OK I created a new |
Codecov Report
@@ Coverage Diff @@
## main #12088 +/- ##
==========================================
+ Coverage 65.32% 65.34% +0.02%
==========================================
Files 689 692 +3
Lines 70706 70788 +82
==========================================
+ Hits 46191 46259 +68
- Misses 21960 21966 +6
- Partials 2555 2563 +8
|
Description
closes #12613
This PR sets up the infrastructure for value renderers as discussed in ADR-050. It's only additive, in a new package, and isn't wired up to the rest of the codebase.
It adds a new root go module
tx
, which has onetextual
subpackage for now.Only adds implementation for:
Sister PR:
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change