MCPcopy
hub / github.com/dnote/dnote / Insert

Method Insert

pkg/cli/database/models.go:60–69  ·  view source on GitHub ↗

Insert inserts a new note

(db *DB)

Source from the content-addressed store, hash-verified

58
59// Insert inserts a new note
60func (n Note) Insert(db *DB) error {
61 _, err := db.Exec("INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
62 n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, n.Dirty)
63
64 if err != nil {
65 return errors.Wrapf(err, "inserting note with uuid %s", n.UUID)
66 }
67
68 return nil
69}
70
71// Update updates the note with the given data
72func (n Note) Update(db *DB) error {

Callers 6

TestNoteInsertFunction · 0.95
TestNoteFTSFunction · 0.95
stepSyncNoteFunction · 0.95
fullSyncNoteFunction · 0.95
writeNoteFunction · 0.95

Calls 1

ExecMethod · 0.65

Tested by 3

TestNoteInsertFunction · 0.76
TestNoteFTSFunction · 0.76