add vendor
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package utils
|
||||
|
||||
import "reflect"
|
||||
|
||||
// ToMap struct to map[string]interface{}
|
||||
func ToMap(ss interface{}) map[string]interface{} {
|
||||
t := reflect.ValueOf(ss).Elem()
|
||||
|
||||
smap := make(map[string]interface{})
|
||||
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
f := t.Field(i)
|
||||
smap[t.Type().Field(i).Name] = f.Interface()
|
||||
}
|
||||
|
||||
return smap
|
||||
}
|
||||
Reference in New Issue
Block a user