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

Method Insert

pkg/cli/database/models.go:118–127  ·  view source on GitHub ↗

Insert inserts a new book

(db *DB)

Source from the content-addressed store, hash-verified

116
117// Insert inserts a new book
118func (b Book) Insert(db *DB) error {
119 _, err := db.Exec("INSERT INTO books (uuid, label, usn, dirty, deleted) VALUES (?, ?, ?, ?, ?)",
120 b.UUID, b.Label, b.USN, b.Dirty, b.Deleted)
121
122 if err != nil {
123 return errors.Wrapf(err, "inserting book with uuid %s", b.UUID)
124 }
125
126 return nil
127}
128
129// Update updates the book with the given data
130func (b Book) Update(db *DB) error {

Callers 4

TestBookInsertFunction · 0.95
mergeBookFunction · 0.95
getConflictsBookUUIDFunction · 0.95
writeNoteFunction · 0.95

Calls 1

ExecMethod · 0.65

Tested by 1

TestBookInsertFunction · 0.76