string을 objectid로 변환하는 케이스 추가
This commit is contained in:
@ -354,9 +354,14 @@ func ConvertInterface(from interface{}, toType reflect.Type) reflect.Value {
|
|||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
val, _ := strconv.ParseBool(from.(string))
|
val, _ := strconv.ParseBool(from.(string))
|
||||||
return reflect.ValueOf(val)
|
return reflect.ValueOf(val)
|
||||||
|
|
||||||
|
case reflect.String:
|
||||||
|
if toType == reflect.TypeOf(primitive.ObjectID{}) {
|
||||||
|
objid, _ := primitive.ObjectIDFromHex(from.(string))
|
||||||
|
return reflect.ValueOf(objid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Println("ConvertInterface :", fromtype.String(), toType.String(), toType.Kind().String())
|
|
||||||
return fromrv.Convert(toType)
|
return fromrv.Convert(toType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user