rimashah25 commented on code in PR #6544:
URL: https://github.com/apache/trafficcontrol/pull/6544#discussion_r848650555


##########
traffic_ops/traffic_ops_golang/server/servers.go:
##########
@@ -1634,6 +1787,36 @@ func Update(w http.ResponseWriter, r *http.Request) {
        api.CreateChangeLogRawTx(api.ApiChange, changeLogMsg, inf.User, tx)
 }
 
+func insertServerProfile(id *int, pName []string, tx *sql.Tx) (error, error, 
int) {
+       insertSPQuery := `
+       INSERT INTO server_profile (
+               server, 
+               profile_name, 
+               priority
+       ) VALUES 
+       `
+
+       //var priorityArray pq.Int64Array
+       //priorityArray = append(priorityArray, int64(i))
+
+       iSPQueryParts := make([]string, 0, len(pName))
+       iSPQueryValues := make([]interface{}, 0, len(pName))
+       for i, name := range pName {
+               valStart := i * 3
+               iSPQueryParts = append(iSPQueryParts, fmt.Sprintf("($%d, $%d, 
$%d)", valStart+1, valStart+2, valStart+3))
+               iSPQueryValues = append(iSPQueryValues, *id, name, i)
+       }
+
+       insertSPQuery += strings.Join(iSPQueryParts, ",")

Review Comment:
   We are doing the same for 
[interface](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/server/servers.go#L1168).
 Do we need to change that too? If not, I am going to stick with the logic I 
have currently.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to