You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "klesh (via GitHub)" <gi...@apache.org> on 2023/08/03 08:53:03 UTC

[GitHub] [incubator-devlake] klesh opened a new pull request, #5803: refactor: move iso8601time and csttime to core/models/common

klesh opened a new pull request, #5803:
URL: https://github.com/apache/incubator-devlake/pull/5803

   ### Summary
   Currently, we have 2 `iso8601time` structs defined in `helpers/pluginhelper/api` and `helpers/utils` which is certainly a mistake. Another problem is both `iso8601time` and `csttime` were put into `helpers/api` which is not the right place for such commonly used structs. This PR fixes these problems.
   
   1. delete `iso8601time` in the `helpers/utils`
   2. move `iso8601time` and `csttime` from `helpers/pluginhelper/api` to `core/models/common` package
   3. all **archived** models use plain `time.Time` instead of the `iso8601time` or `csttime` because they must be immutable and they don't need the features offered by these structs.
    
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] d4x1 commented on a diff in pull request #5803: refactor: move iso8601time and csttime to core/models/common

Posted by "d4x1 (via GitHub)" <gi...@apache.org>.
d4x1 commented on code in PR #5803:
URL: https://github.com/apache/incubator-devlake/pull/5803#discussion_r1282980112


##########
backend/core/models/common/iso8601time.go:
##########
@@ -77,7 +77,7 @@ func init() {
 
 // Iso8601Time is type time.Time
 type Iso8601Time struct {
-	time   time.Time
+	Time   time.Time

Review Comment:
   If `Time` field is not private, then method `Iso8601Time.ToTime` will be duplicated. 
   Can we delete it ?



##########
backend/impls/dalgorm/db_mapper.go:
##########
@@ -33,7 +34,7 @@ func ToDatabaseMap(tableName string, m map[string]any) map[string]any {
 			continue
 		}
 		if str, ok := v.(string); ok {
-			t, err := api.ConvertStringToTime(str)
+			t, err := common.ConvertStringToTime(str)

Review Comment:
   `common` is under `models` package, `ConvertStringToTime` is a function, can we put it to `pluginhelper`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn merged pull request #5803: refactor: move iso8601time and csttime to core/models/common

Posted by "abeizn (via GitHub)" <gi...@apache.org>.
abeizn merged PR #5803:
URL: https://github.com/apache/incubator-devlake/pull/5803


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org