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

Function getConflictsBookUUID

pkg/cli/cmd/sync/merge.go:131–153  ·  view source on GitHub ↗
(tx *database.DB)

Source from the content-addressed store, hash-verified

129}
130
131func getConflictsBookUUID(tx *database.DB) (string, error) {
132 var ret string
133
134 err := tx.QueryRow("SELECT uuid FROM books WHERE label = ?", "conflicts").Scan(&ret)
135 if err == sql.ErrNoRows {
136 // Create a conflicts book
137 ret, err = utils.GenerateUUID()
138 if err != nil {
139 return "", err
140 }
141
142 b := database.NewBook(ret, "conflicts", 0, false, true)
143 err = b.Insert(tx)
144 if err != nil {
145 tx.Rollback()
146 return "", errors.Wrap(err, "creating the conflicts book")
147 }
148 } else if err != nil {
149 return "", errors.Wrap(err, "getting uuid for conflicts book")
150 }
151
152 return ret, nil
153}
154
155// noteMergeReport holds the result of a field-by-field merge of two copies of notes
156type noteMergeReport struct {

Callers 1

mergeNoteFieldsFunction · 0.85

Calls 5

InsertMethod · 0.95
GenerateUUIDFunction · 0.92
NewBookFunction · 0.92
QueryRowMethod · 0.65
RollbackMethod · 0.65

Tested by

no test coverage detected