package convx import ( "errors" ) func AutoConv(toType string, target interface{}) (interface{}, error) { var v interface{} err := errors.New("not support type") switch toType { case "float64": v, err = ToFloat64(target) case "float32": v, err = ToFloat32(target) case "int": v, err = ToInt(target) case "int64": v, err = ToInt64(target) case "int32": v, err = ToInt32(target) case "string": v = ToString(target) } return v, err }