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