1
0
Fork 0

Hope it works

This commit is contained in:
Gregory Eremin 2018-07-09 00:46:43 +02:00
parent e9e7b5058f
commit 55fcca661e
1 changed files with 8 additions and 0 deletions

View File

@ -25,3 +25,11 @@ func AssociateColumns(typ reflect.Type, tag string, cols []string) map[int]int {
}
return colFields
}
// Dereference keeps dereferencing pointers until a value is found.
func Dereference(val reflect.Value) reflect.Value {
for val.Kind() == reflect.Ptr && val.CanAddr() {
val = val.Elem()
}
return val
}