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

Function checkNotesPristine

pkg/cli/cmd/sync/sync.go:437–448  ·  view source on GitHub ↗

checkNotesPristine checks that none of the notes in the given book are dirty

(tx *database.DB, bookUUID string)

Source from the content-addressed store, hash-verified

435
436// checkNotesPristine checks that none of the notes in the given book are dirty
437func checkNotesPristine(tx *database.DB, bookUUID string) (bool, error) {
438 var count int
439 if err := tx.QueryRow("SELECT count(*) FROM notes WHERE book_uuid = ? AND dirty = ?", bookUUID, true).Scan(&count); err != nil {
440 return false, errors.Wrapf(err, "counting notes that are dirty in book %s", bookUUID)
441 }
442
443 if count > 0 {
444 return false, nil
445 }
446
447 return true, nil
448}
449
450func syncDeleteBook(tx *database.DB, bookUUID string) error {
451 var localUSN int

Callers 2

syncDeleteBookFunction · 0.85
TestCheckBookPristineFunction · 0.85

Calls 1

QueryRowMethod · 0.65

Tested by 1

TestCheckBookPristineFunction · 0.68