rob05c commented on a change in pull request #4942:
URL: https://github.com/apache/trafficcontrol/pull/4942#discussion_r468288116
##########
File path: traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go
##########
@@ -567,6 +582,22 @@ func (cg *TOCacheGroup) Update() (error, error, int) {
return nil, nil, http.StatusOK
}
+func CheckIfExistsBeforeUpdate(tx *sqlx.Tx, cgID int) (error, *tc.TimeNoMod) {
Review comment:
These functions look identical, except for the table in the select query.
Could they be abstracted/refactored to use a common func, maybe something
like
```
// GetLastUpdated returns the last updated time of the given ID in the given
table, whether the ID existed, and any error.
func GetLastUpdated(tx *sqlx.Tx, dbTable string, id int) (time.Time, bool,
error)
````
In the `api` package?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]