Maybe https://github.com/mitchellh/mapstructure
Will help you a bit
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
For
Hi!
On Thu, Mar 29, 2018 at 04:29:09AM -0700, gary.willoug...@victoriaplumb.com
wrote:
> Thanks for the all the responses but I was after a more dynamic solution
> where you don't need to 'register' the types or select them using a switch
> but that it just works.
I believe this is just a
Thanks for the all the responses but I was after a more dynamic solution
where you don't need to 'register' the types or select them using a switch
but that it just works.
For example, to support new types (like the PHP code) I was hoping you
could just add the structs and no more changes to
I implemented a type registry solution for this situation:
https://github.com/rcoreilly/goki/tree/master/ki/kit
you just add a one-liner after every struct you want to register, and it builds
the map for you — makes it fully modular, etc. Cheers,
- Randy
> On Mar 28, 2018, at 12:59 PM, Alex
Hi!
On Wed, Mar 28, 2018 at 02:13:55PM -0400, Shawn Milochik wrote:
> Thanks for the challenge! I found some unused code in the getItem function,
> and a way to make it a bit shorter by removing the lookup map. However,
> depending on the number of struct types the map may be cleaner for OP.
>
>
Thanks for the challenge! I found some unused code in the getItem function,
and a way to make it a bit shorter by removing the lookup map. However,
depending on the number of struct types the map may be cleaner for OP.
https://play.golang.org/p/ZH09nHsrRoR
--
You received this message because
Hi!
On Wed, Mar 28, 2018 at 01:38:04PM -0400, Shawn Milochik wrote:
> Yes, you can do this. Perhaps someone knows of some kind of cleaner
> shortcuts to get there, but this works and is easy to understand without
> any magic:
>
> https://play.golang.org/p/tqon7s2KxTz
Here is a bit simplified
Yes, you can do this. Perhaps someone knows of some kind of cleaner
shortcuts to get there, but this works and is easy to understand without
any magic:
https://play.golang.org/p/tqon7s2KxTz
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To
Is it possible to unmarshall Json by selecting the struct from a field in
the Json?
I'm porting some PHP code to Go and this is something I may have to
approach differently.
Here is the Json:
[
{
"class": "Domain\\Model\\Message",
"skus": [
"FOO1"
],