mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
* add support json tag attribute for StructToMap function * add the structutil to provide more rich functions and fixed #77 * add support that the nested struct to map for structutil * recover code * add structutil unit test * [StructUtil] add unit test
15 lines
304 B
Go
15 lines
304 B
Go
package pointer
|
|
|
|
import "reflect"
|
|
|
|
// ExtractPointer returns the underlying value by the given interface type
|
|
func ExtractPointer(value any) any {
|
|
t := reflect.TypeOf(value)
|
|
v := reflect.ValueOf(value)
|
|
|
|
if t.Kind() != reflect.Pointer {
|
|
return value
|
|
}
|
|
return ExtractPointer(v.Elem().Interface())
|
|
}
|