dangogh closed pull request #2639: Fix TO Go profileparameters to match Perl
URL: https://github.com/apache/trafficcontrol/pull/2639
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/lib/go-tc/parameters.go b/lib/go-tc/parameters.go
index afa610365..a383f085c 100644
--- a/lib/go-tc/parameters.go
+++ b/lib/go-tc/parameters.go
@@ -258,3 +258,10 @@ func ParamsExist(ids []int64, tx *sql.Tx) (bool, error) {
}
return count == len(ids), nil
}
+
+// ProfileParametersNullable is an object of the form returned by the Traffic
Ops /profileparameters endpoint.
+type ProfileParametersNullable struct {
+ LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
+ Profile *string `json:"profile" db:"profile"`
+ Parameter *int `json:"parameter" db:"parameter_id"`
+}
diff --git
a/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go
b/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go
index 2eb33c6da..af7d8393e 100644
--- a/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go
+++ b/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go
@@ -195,7 +195,7 @@ func (pp *TOProfileParameter) Read(parameters
map[string]string) ([]interface{},
params := []interface{}{}
for rows.Next() {
- var p v13.ProfileParameterNullable
+ p := tc.ProfileParametersNullable{}
if err = rows.StructScan(&p); err != nil {
log.Errorf("error parsing pp rows: %v", err)
return nil, []error{tc.DBError}, tc.SystemError
@@ -234,10 +234,8 @@ func selectQuery() string {
query := `SELECT
pp.last_updated,
-pp.profile profile_id,
pp.parameter parameter_id,
-prof.name profile,
-param.name parameter
+prof.name profile
FROM profile_parameter pp
JOIN profile prof ON prof.id = pp.profile
JOIN parameter param ON param.id = pp.parameter`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services