-
Notifications
You must be signed in to change notification settings - Fork 3
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: Support encoding/emitting nested structures with binary fields #1
base: main
Are you sure you want to change the base?
Changes from 1 commit
4597211
111a35d
005578a
379e950
b80f54d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,9 @@ func HasBinary(data any) bool { | |
return false | ||
} | ||
dv := reflect.ValueOf(data) | ||
if dv.Kind() == reflect.Pointer { | ||
return IsBinary(dv.Elem().Interface()) | ||
} | ||
if dv.Kind() == reflect.Struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe consider adding reflect.Ptr support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough! I wasn't sure how well updated this library was and whether you'd like the PR at all since it feels a little hacky to me, so wanted to get something basic out first. :D Will add this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, given this feature, we can even do more, such as support for Array and Map. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done! |
||
for fi := range dv.NumField() { | ||
dfv := dv.Field(fi) | ||
|
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 need to run more test cases to ensure that this request is OK. It may take longer.
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.
There's no rush. I've already taken the encoder from this branch and I'm using it in my project that way via the config.Encoder.