mardi 13 octobre 2015

Is it possible to merge/merge multiple structs into one dynamically (using reflect)?

I need to build a function which merges responses from multiple other functions into one (struct). Currently I'm thinking that the only way would be to create a map[string]interface{} and then range over the fields of structs I need to merge and assign field name -> value as key, values in the map. Is there any other way? I basically just need to embed two structs into one.





Aucun commentaire:

Enregistrer un commentaire