Update adds or updates information about package in DB
(p *Package)
| 203 | |
| 204 | // Update adds or updates information about package in DB |
| 205 | func (collection *PackageCollection) Update(p *Package) error { |
| 206 | transaction, err := collection.db.OpenTransaction() |
| 207 | if err != nil { |
| 208 | return err |
| 209 | } |
| 210 | defer transaction.Discard() |
| 211 | |
| 212 | if err = collection.UpdateInTransaction(p, transaction); err != nil { |
| 213 | return err |
| 214 | } |
| 215 | |
| 216 | return transaction.Commit() |
| 217 | } |
| 218 | |
| 219 | // UpdateInTransaction updates/creates package info in the context of the outer transaction |
| 220 | func (collection *PackageCollection) UpdateInTransaction(p *Package, transaction database.Transaction) error { |