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

Function GetNoteInfo

pkg/cli/database/queries.go:92–107  ·  view source on GitHub ↗

GetNoteInfo returns a NoteInfo for the note with the given noteRowID

(db *DB, noteRowID int)

Source from the content-addressed store, hash-verified

90
91// GetNoteInfo returns a NoteInfo for the note with the given noteRowID
92func GetNoteInfo(db *DB, noteRowID int) (NoteInfo, error) {
93 var ret NoteInfo
94
95 err := db.QueryRow(`SELECT books.label, notes.uuid, notes.body, notes.added_on, notes.edited_on, notes.rowid
96 FROM notes
97 INNER JOIN books ON books.uuid = notes.book_uuid
98 WHERE notes.rowid = ? AND notes.deleted = false`, noteRowID).
99 Scan(&ret.BookLabel, &ret.UUID, &ret.Content, &ret.AddedOn, &ret.EditedOn, &ret.RowID)
100 if err == sql.ErrNoRows {
101 return ret, errors.Errorf("note %d not found", noteRowID)
102 } else if err != nil {
103 return ret, errors.Wrap(err, "querying the note")
104 }
105
106 return ret, nil
107}
108
109// BookInfo is a basic information about a book
110type BookInfo struct {

Callers 4

viewNoteFunction · 0.92
runNoteFunction · 0.92
newRunFunction · 0.92
runNoteFunction · 0.92

Calls 1

QueryRowMethod · 0.65

Tested by

no test coverage detected