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

Function moveBook

pkg/cli/cmd/edit/note.go:82–97  ·  view source on GitHub ↗
(ctx context.DnoteCtx, tx *database.DB, note database.Note, bookName string)

Source from the content-addressed store, hash-verified

80}
81
82func moveBook(ctx context.DnoteCtx, tx *database.DB, note database.Note, bookName string) error {
83 targetBookUUID, err := database.GetBookUUID(tx, bookName)
84 if err != nil {
85 return errors.Wrap(err, "finding book uuid")
86 }
87
88 if note.BookUUID == targetBookUUID {
89 return errors.New("book has not changed")
90 }
91
92 if err := database.UpdateNoteBook(tx, ctx.Clock, note.RowID, targetBookUUID); err != nil {
93 return errors.Wrap(err, "moving book")
94 }
95
96 return nil
97}
98
99func updateNote(ctx context.DnoteCtx, tx *database.DB, note database.Note, bookName, content string) error {
100 if bookName != "" {

Callers 1

updateNoteFunction · 0.85

Calls 3

GetBookUUIDFunction · 0.92
UpdateNoteBookFunction · 0.92
NewMethod · 0.80

Tested by

no test coverage detected