MCPcopy Index your code
hub / github.com/dnote/dnote / GetBookInfo

Function GetBookInfo

pkg/cli/database/queries.go:117–131  ·  view source on GitHub ↗

GetBookInfo returns a BookInfo for the book with the given uuid

(db *DB, uuid string)

Source from the content-addressed store, hash-verified

115
116// GetBookInfo returns a BookInfo for the book with the given uuid
117func GetBookInfo(db *DB, uuid string) (BookInfo, error) {
118 var ret BookInfo
119
120 err := db.QueryRow(`SELECT books.rowid, books.uuid, books.label
121 FROM books
122 WHERE books.uuid = ? AND books.deleted = false`, uuid).
123 Scan(&ret.RowID, &ret.UUID, &ret.Name)
124 if err == sql.ErrNoRows {
125 return ret, errors.Errorf("book %s not found", uuid)
126 } else if err != nil {
127 return ret, errors.Wrap(err, "querying the note")
128 }
129
130 return ret, nil
131}
132
133// GetBookUUID returns a uuid of a book given a label
134func GetBookUUID(db *DB, label string) (string, error) {

Callers 1

runBookFunction · 0.92

Calls 1

QueryRowMethod · 0.65

Tested by

no test coverage detected