func Get(f string,value interface{}) interface{}{
temp := fmt.Sprint(value)
switch f.Type {
case "string":
return temp
case "bool":
b,err := strconv.ParseBool(temp)
if err!=nil{
return "Bool类型输入错误"
}
return b
case "int":
b,err := strconv.ParseInt(temp,10,64)
if err!=nil{
return "Number类型输入错误"
}
return b
default:
return "请输入正确的数据类型"
}
}
标签:case,return,string,err,interface,temp,Go
From: https://www.cnblogs.com/gtea/p/17106041.html