PtrValue returns the pointer version (Addr()) of the underlying value if the value is not already a Ptr
(v reflect.Value)
| 61 | // PtrValue returns the pointer version (Addr()) of the underlying value if |
| 62 | // the value is not already a Ptr |
| 63 | func PtrValue(v reflect.Value) reflect.Value { |
| 64 | if v.CanAddr() && v.Kind() != reflect.Ptr { |
| 65 | v = v.Addr() |
| 66 | } |
| 67 | return v |
| 68 | } |
| 69 | |
| 70 | // Embed returns the embedded struct (in first field only) of given type within given struct |
| 71 | func Embed(stru interface{}, embed reflect.Type) interface{} { |