Skip to content

Commit 0565fcc

Browse files
committed
Merge pull request #21 from hpcloud/fix-scan-error
Fix scan error for list user registered clusters
2 parents a160e65 + 804e9dc commit 0565fcc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

repository/cnsis/pgsql_cnsis.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,20 @@ func (p *PostgresCNSIRepository) ListByUser(userGUID string) ([]*RegisteredClust
8989
clusterList = make([]*RegisteredCluster, 0)
9090

9191
for rows.Next() {
92+
var (
93+
pURL string
94+
)
95+
9296
cluster := new(RegisteredCluster)
93-
err := rows.Scan(&cluster.GUID, &cluster.Name, &cluster.APIEndpoint, &cluster.Account, &cluster.TokenExpiry)
97+
err := rows.Scan(&cluster.GUID, &cluster.Name, &pURL, &cluster.Account, &cluster.TokenExpiry)
9498
if err != nil {
9599
return nil, fmt.Errorf("Unable to scan cluster records: %v", err)
96100
}
101+
102+
if cluster.APIEndpoint, err = url.Parse(pURL); err != nil {
103+
return nil, fmt.Errorf("Unable to parse API Endpoint: %v", err)
104+
}
105+
97106
clusterList = append(clusterList, cluster)
98107
}
99108

0 commit comments

Comments
 (0)