convertinterface 보완

This commit is contained in:
2025-10-01 21:32:08 +09:00
parent 289594716c
commit 56cf9ba23c

View File

@ -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{}) {