Add appends new repo to collection and saves it
(repo *RemoteRepo)
| 928 | |
| 929 | // Add appends new repo to collection and saves it |
| 930 | func (collection *RemoteRepoCollection) Add(repo *RemoteRepo) error { |
| 931 | _, err := collection.ByName(repo.Name) |
| 932 | |
| 933 | if err == nil { |
| 934 | return fmt.Errorf("mirror with name %s already exists", repo.Name) |
| 935 | } |
| 936 | |
| 937 | err = collection.Update(repo) |
| 938 | if err != nil { |
| 939 | return err |
| 940 | } |
| 941 | |
| 942 | collection.cache[repo.UUID] = repo |
| 943 | return nil |
| 944 | } |
| 945 | |
| 946 | // Update stores updated information about repo in DB |
| 947 | func (collection *RemoteRepoCollection) Update(repo *RemoteRepo) error { |
no test coverage detected