-
Notifications
You must be signed in to change notification settings - Fork 230
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
[Question] Form encoding/decoding ignores slice of struct #214
Comments
I added an if to catch the error and it seems it's missing an encoder. err := encoder.Encode(person, form)
if err != nil {
fmt.Println(err)
}
|
So it seems that it's not a bug but I find the behavior rather odd because if I follow the docs they mention
So why do I need a custom encoder/decoder even tho my struct only contains supported fields ( |
That's a great question @tommysalt thanks for bringing this to our attention. I'm not sure what the answer is right now but I'll try to answer it in the near future. |
Hello @tommysalt Thanks for bringing this up! As soon as the encoder detects that the field type is a slice, it checks for the dataType, and if the dataType is custom, it returns
It actually means,
& probably not a struct. |
Current Behavior
When encoding/decoding from data with slices of custom structs, they are ignored even thought the examples mention:
Output:
Expected Behavior
Output:
Steps To Reproduce
Output:
The text was updated successfully, but these errors were encountered: