UpdateUUID updates the uuid of a book
(db *DB, newUUID string)
| 82 | |
| 83 | // UpdateUUID updates the uuid of a book |
| 84 | func (n *Note) UpdateUUID(db *DB, newUUID string) error { |
| 85 | _, err := db.Exec("UPDATE notes SET uuid = ? WHERE uuid = ?", newUUID, n.UUID) |
| 86 | |
| 87 | if err != nil { |
| 88 | return errors.Wrapf(err, "updating note uuid from '%s' to '%s'", n.UUID, newUUID) |
| 89 | } |
| 90 | |
| 91 | n.UUID = newUUID |
| 92 | |
| 93 | return nil |
| 94 | } |
| 95 | |
| 96 | // Expunge hard-deletes the note from the database |
| 97 | func (n Note) Expunge(db *DB) error { |