string을 objectid로 변환하는 케이스 추가

This commit is contained in:
2025-07-23 12:21:00 +09:00
parent 49f2bd077d
commit b801be6aca

View File

@ -354,9 +354,14 @@ func ConvertInterface(from interface{}, toType reflect.Type) reflect.Value {
case reflect.Bool:
val, _ := strconv.ParseBool(from.(string))
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)
}