Insert inserts a new book
(db *DB)
| 116 | |
| 117 | // Insert inserts a new book |
| 118 | func (b Book) Insert(db *DB) error { |
| 119 | _, err := db.Exec("INSERT INTO books (uuid, label, usn, dirty, deleted) VALUES (?, ?, ?, ?, ?)", |
| 120 | b.UUID, b.Label, b.USN, b.Dirty, b.Deleted) |
| 121 | |
| 122 | if err != nil { |
| 123 | return errors.Wrapf(err, "inserting book with uuid %s", b.UUID) |
| 124 | } |
| 125 | |
| 126 | return nil |
| 127 | } |
| 128 | |
| 129 | // Update updates the book with the given data |
| 130 | func (b Book) Update(db *DB) error { |