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

Function GetActiveNote

pkg/cli/database/queries.go:159–191  ·  view source on GitHub ↗

GetActiveNote gets the note which has the given rowid and is not deleted

(db *DB, rowid int)

Source from the content-addressed store, hash-verified

157
158// GetActiveNote gets the note which has the given rowid and is not deleted
159func GetActiveNote(db *DB, rowid int) (Note, error) {
160 var ret Note
161
162 err := db.QueryRow(`SELECT
163 rowid,
164 uuid,
165 book_uuid,
166 body,
167 added_on,
168 edited_on,
169 usn,
170 deleted,
171 dirty
172 FROM notes WHERE rowid = ? AND deleted = false;`, rowid).Scan(
173 &ret.RowID,
174 &ret.UUID,
175 &ret.BookUUID,
176 &ret.Body,
177 &ret.AddedOn,
178 &ret.EditedOn,
179 &ret.USN,
180 &ret.Deleted,
181 &ret.Dirty,
182 )
183
184 if err == sql.ErrNoRows {
185 return ret, err
186 } else if err != nil {
187 return ret, errors.Wrap(err, "finding the note")
188 }
189
190 return ret, nil
191}
192
193// UpdateNoteContent updates the note content and marks the note as dirty
194func UpdateNoteContent(db *DB, c clock.Clock, rowID int, content string) error {

Callers 2

runNoteFunction · 0.92
TestGetActiveNoteFunction · 0.85

Calls 1

QueryRowMethod · 0.65

Tested by 1

TestGetActiveNoteFunction · 0.68