change SetBuildRootPackages to use proper pq types and set defaults on nil

This commit is contained in:
Neil Hanlon 2023-01-05 18:17:51 -05:00
parent 60a3885b91
commit aa3a97cb87
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
2 changed files with 9 additions and 2 deletions

View File

@ -46,7 +46,7 @@ type Access interface {
CreateProject(project *peridotpb.Project) (*models.Project, error)
UpdateProject(id string, project *peridotpb.Project) (*models.Project, error)
SetProjectKeys(projectId string, username string, password string) error
SetBuildRootPackages(projectId string, srpmPackages []string, buildPackages []string) error
SetBuildRootPackages(projectId string, srpmPackages pq.StringArray, buildPackages pq.StringArray) error
CreateBuild(packageId string, packageVersionId string, taskId string, projectId string) (*models.Build, error)
GetArtifactsForBuild(buildId string) (models.TaskArtifacts, error)

View File

@ -339,7 +339,14 @@ func (a *Access) SetProjectKeys(projectId string, username string, password stri
return err
}
func (a *Access) SetBuildRootPackages(projectId string, srpmPackages []string, buildPackages []string) error {
func (a *Access) SetBuildRootPackages(projectId string, srpmPackages pq.StringArray, buildPackages pq.StringArray) error {
if srpmPackages == nil {
srpmPackages = pq.StringArray{}
}
if buildPackages == nil {
buildPackages = pq.StringArray{}
}
_, err := a.query.Exec(
`
update projects set srpm_stage_packages = $2, build_stage_packages = $3