Skip to content

Commit 084df2b

Browse files
committed
oss/ent change
1 parent 606164e commit 084df2b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

internal/sql/repository/deploymentConfig/repository.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type DeploymentConfig struct {
4545
ConfigType string `sql:"config_type"`
4646
RepoUrl string `sql:"repo_url"`
4747
RepoName string `sql:"repo_name"`
48-
ReleaseMode string `json:"release_mode"`
48+
ReleaseMode string `sql:"release_mode"`
4949
Active bool `sql:"active,notnull"`
5050
sql.AuditLog
5151
}
@@ -103,14 +103,19 @@ func (impl *RepositoryImpl) Update(tx *pg.Tx, config *DeploymentConfig) (*Deploy
103103
return config, err
104104
}
105105

106-
func (impl *RepositoryImpl) UpdateAll(tx *pg.Tx, config []*DeploymentConfig) ([]*DeploymentConfig, error) {
106+
func (impl *RepositoryImpl) UpdateAll(tx *pg.Tx, configs []*DeploymentConfig) ([]*DeploymentConfig, error) {
107107
var err error
108-
if tx != nil {
109-
err = tx.Update(config)
110-
} else {
111-
err = impl.dbConnection.Update(config)
108+
for _, config := range configs {
109+
if tx != nil {
110+
_, err = tx.Model(config).WherePK().UpdateNotNull()
111+
} else {
112+
_, err = impl.dbConnection.Model(&config).UpdateNotNull()
113+
}
114+
if err != nil {
115+
return nil, err
116+
}
112117
}
113-
return config, err
118+
return configs, err
114119
}
115120

116121
func (impl *RepositoryImpl) GetById(id int) (*DeploymentConfig, error) {

0 commit comments

Comments
 (0)