Add appends new repo to collection and saves it
(repo *LocalRepo)
| 141 | |
| 142 | // Add appends new repo to collection and saves it |
| 143 | func (collection *LocalRepoCollection) Add(repo *LocalRepo) error { |
| 144 | _, err := collection.ByName(repo.Name) |
| 145 | |
| 146 | if err == nil { |
| 147 | return fmt.Errorf("local repo with name %s already exists", repo.Name) |
| 148 | } |
| 149 | |
| 150 | err = collection.Update(repo) |
| 151 | if err != nil { |
| 152 | return err |
| 153 | } |
| 154 | |
| 155 | collection.cache[repo.UUID] = repo |
| 156 | return nil |
| 157 | } |
| 158 | |
| 159 | // Update stores updated information about repo in DB |
| 160 | func (collection *LocalRepoCollection) Update(repo *LocalRepo) error { |