add vendor

This commit is contained in:
Jay
2018-04-17 18:04:36 +08:00
parent a45b1f3603
commit 4fd4c7018e
494 changed files with 255023 additions and 9 deletions
+17
View File
@@ -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
}