|
|
@@ -17,19 +17,32 @@ func NewBuildConfigRepository(canQuery bool) repository.BuildConfigRepository {
|
|
|
}
|
|
|
|
|
|
func (repo *BuildConfigRepository) CreateBuildConfig(
|
|
|
- a *models.BuildConfig,
|
|
|
+ bc *models.BuildConfig,
|
|
|
) (*models.BuildConfig, error) {
|
|
|
if !repo.canQuery {
|
|
|
return nil, errors.New("cannot write database")
|
|
|
}
|
|
|
|
|
|
- repo.buildConfigs = append(repo.buildConfigs, a)
|
|
|
- a.ID = uint(len(repo.buildConfigs))
|
|
|
+ repo.buildConfigs = append(repo.buildConfigs, bc)
|
|
|
+ bc.ID = uint(len(repo.buildConfigs))
|
|
|
|
|
|
- return a, nil
|
|
|
+ return bc, nil
|
|
|
}
|
|
|
|
|
|
func (repo *BuildConfigRepository) UpdateBuildConfig(bc *models.BuildConfig) (*models.BuildConfig, error) {
|
|
|
+ if !repo.canQuery {
|
|
|
+ return nil, errors.New("cannot write database")
|
|
|
+ }
|
|
|
+
|
|
|
// TODO
|
|
|
return bc, nil
|
|
|
}
|
|
|
+
|
|
|
+func (repo *BuildConfigRepository) GetBuildConfig(id uint) (*models.BuildConfig, error) {
|
|
|
+ if !repo.canQuery {
|
|
|
+ return nil, errors.New("cannot write database")
|
|
|
+ }
|
|
|
+
|
|
|
+ // TODO
|
|
|
+ return nil, nil
|
|
|
+}
|