convertinterface 보완
This commit is contained in:
@ -352,8 +352,13 @@ func ConvertInterface(from interface{}, toType reflect.Type) reflect.Value {
|
||||
return convslice
|
||||
|
||||
case reflect.Bool:
|
||||
val, _ := strconv.ParseBool(from.(string))
|
||||
return reflect.ValueOf(val)
|
||||
if fromstr, ok := from.(string); ok {
|
||||
val, _ := strconv.ParseBool(fromstr)
|
||||
return reflect.ValueOf(val)
|
||||
} else if frombool, ok := from.(bool); ok {
|
||||
return reflect.ValueOf(frombool)
|
||||
}
|
||||
return reflect.ValueOf(false)
|
||||
|
||||
case reflect.String:
|
||||
if toType == reflect.TypeOf(primitive.ObjectID{}) {
|
||||
|
||||
Reference in New Issue
Block a user