MCPcopy Index your code
hub / github.com/TruthHun/BookStack / InsertOrUpdate

Method InsertOrUpdate

models/label.go:43–54  ·  view source on GitHub ↗

插入或更新标签.

(labelName string)

Source from the content-addressed store, hash-verified

41
42//插入或更新标签.
43func (m *Label) InsertOrUpdate(labelName string) (err error) {
44 o := orm.NewOrm()
45 count, _ := o.QueryTable(NewBook().TableNameWithPrefix()).Filter("label", labelName).Count()
46 m.BookNumber = int(count) + 1
47 m.LabelName = labelName
48 if count == 0 {
49 _, err = o.Insert(m)
50 } else {
51 _, err = o.Update(m)
52 }
53 return
54}
55
56//批量插入或更新标签.
57func (m *Label) InsertOrUpdateMulti(labels string) {

Callers 11

CreateMethod · 0.45
CreateMultiMethod · 0.45
ContentMethod · 0.45
sortBySummaryMethod · 0.45
ValidEmailMethod · 0.45
RenderMarkdownMethod · 0.45
unzipToDataMethod · 0.45
loadByFolderMethod · 0.45
SettingMethod · 0.45
InsertOrUpdateMultiMethod · 0.45
InsertMethod · 0.45

Calls 5

NewBookFunction · 0.85
CountMethod · 0.45
TableNameWithPrefixMethod · 0.45
InsertMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected