guregu / null

reasonable handling of nullable values
BSD 2-Clause "Simplified" License
1.84k stars 238 forks source link

Implement BindUnmarshaler #32

Closed arp242 closed 6 years ago

arp242 commented 6 years ago

This adds the UnmarshalParam() function from the BindUnmarshaler interface from echo: https://github.com/labstack/echo/blob/60072188355b8972c738a041666bd4b05957c135/bind.go#L24

This is useful for unmarshaling form and query values, and since it's (mostly) a proxy to UnmarshalText() I don't see any downsides in adding it. The only exception is the Bool; I had to add on and off. I could add these just for UnmarshalParam, but it seemed useful to me to add it to UnmarshalText as well.

arp242 commented 6 years ago

Any thoughts about this @guregu? Would you like to see any changes?

Thanks!

guregu commented 6 years ago

Hello, I think your code is fine and I appreciate the PR, but I don't want to add support for third party libraries in this. There's just too many potential things to support and the code is bloated as-is. Also, messing with UnmarshalText will break backwards compatibility. I think it's a better idea to use a fork.

arp242 commented 6 years ago

Okay, fair enough. Thanks for looking at it!