think that there are two struct, they have different fields, hope that 
there has a function merge(a,b interface{}) interface{}, input param are 
any two struct, they may have same-type, or have different-type. output 
param is a struct that composed the two input struct, example type A 
sturct{Name string}, type B struct{Age int}, a,b :=A{"xxx"},B{10} called 
c:= merge(a,b), c is interface{}, and 

import "github.com/google/go-querystring/query",

v, _ := query.Values(opt)
fmt.Print(v.Encode()) // will output: "name=xxx&age=10"



在 2019年8月24日星期六 UTC+8下午1:25:01,Kurtis Rader写道:
>
> On Fri, Aug 23, 2019 at 10:11 PM Lee Rick <blade...@gmail.com 
> <javascript:>> wrote:
>
>> it's not my need, hope other methods
>>
>
> Then you need to explain why that answer is not satisfactory and otherwise 
> better explain your requirements. In your hypothetical example the objects 
> such as `d1` would not be usable except via reflection (assuming that 
> approach was even viable). What exactly would be the point? If you need a 
> data structure that can be composed at run time there are many options. Why 
> does it need to be a Go struct?
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0fb119eb-677f-4b0c-a6e3-ffa62a0cef32%40googlegroups.com.

Reply via email to