Insert inserts a new note
(db *DB)
| 58 | |
| 59 | // Insert inserts a new note |
| 60 | func (n Note) Insert(db *DB) error { |
| 61 | _, err := db.Exec("INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", |
| 62 | n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, n.Dirty) |
| 63 | |
| 64 | if err != nil { |
| 65 | return errors.Wrapf(err, "inserting note with uuid %s", n.UUID) |
| 66 | } |
| 67 | |
| 68 | return nil |
| 69 | } |
| 70 | |
| 71 | // Update updates the note with the given data |
| 72 | func (n Note) Update(db *DB) error { |