GetBookUUID returns a uuid of a book given a label
(db *DB, label string)
| 132 | |
| 133 | // GetBookUUID returns a uuid of a book given a label |
| 134 | func GetBookUUID(db *DB, label string) (string, error) { |
| 135 | var ret string |
| 136 | err := db.QueryRow("SELECT uuid FROM books WHERE label = ?", label).Scan(&ret) |
| 137 | if err == sql.ErrNoRows { |
| 138 | return ret, errors.Errorf("book '%s' not found", label) |
| 139 | } else if err != nil { |
| 140 | return ret, errors.Wrap(err, "querying the book") |
| 141 | } |
| 142 | |
| 143 | return ret, nil |
| 144 | } |
| 145 | |
| 146 | // UpdateBookName updates a book name |
| 147 | func UpdateBookName(db *DB, uuid string, name string) error { |