Update updates the note with the given data
(db *DB)
| 70 | |
| 71 | // Update updates the note with the given data |
| 72 | func (n Note) Update(db *DB) error { |
| 73 | _, err := db.Exec("UPDATE notes SET book_uuid = ?, body = ?, added_on = ?, edited_on = ?, usn = ?, deleted = ?, dirty = ? WHERE uuid = ?", |
| 74 | n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, n.Dirty, n.UUID) |
| 75 | |
| 76 | if err != nil { |
| 77 | return errors.Wrapf(err, "updating the note with uuid %s", n.UUID) |
| 78 | } |
| 79 | |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | // UpdateUUID updates the uuid of a book |
| 84 | func (n *Note) UpdateUUID(db *DB, newUUID string) error { |