-
Notifications
You must be signed in to change notification settings - Fork 0
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
consume: add Avro support #25
Conversation
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! Couple of small points, I'll let @rogpeppe speak to any specific suggestions about the structure of hkt as he know it better.
if body == nil { | ||
return nil, fmt.Errorf("cannot decode schema id") | ||
} | ||
// TODO: cache the schema |
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.
TODO's are great, but I like them to be converted into issues, so that they can be scheduled and not forgotten when we don't regularly visit the code.
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.
👍 Done (#26).
var enc func([]byte) string | ||
switch typ { | ||
case "json": | ||
return func(data []byte) (json.RawMessage, 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.
At this point I'd probably consider pushing the generation of this function (and the one like it below) out to named functions of their own, just because the switch statement is getting a bit long.
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.
True. I will do it in another PR.
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 tried to "simplify" the switch using a map with dedicated method per type: 0e4a242 If you think it's okay, I can propose the PR (it's based on this branch).
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.
Personally I don't think it's too unwieldy currently - not sure that splitting it up will help readability.
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 looks great, thanks! I'd really like to see an end-to-end test in testdata
, but that's hard without the produce side, I guess. I've a few minor comments and suggestions, but otherwise LGTM.
var enc func([]byte) string | ||
switch typ { | ||
case "json": | ||
return func(data []byte) (json.RawMessage, 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.
Personally I don't think it's too unwieldy currently - not sure that splitting it up will help readability.
ceaf6fd
to
73dc2ee
Compare
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.
Still LGTM.
consume
commandkt
->hkt