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

Method InsertOrUpdate

models/options.go:84–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82}
83
84func (p *Option) InsertOrUpdate() error {
85 defer func() {
86 initOptionCache()
87 }()
88 o := orm.NewOrm()
89
90 var err error
91
92 if p.OptionId > 0 || o.QueryTable(p.TableNameWithPrefix()).Filter("option_name", p.OptionName).Exist() {
93 _, err = o.Update(p)
94 } else {
95 _, err = o.Insert(p)
96 }
97 return err
98}
99
100func (p *Option) InsertMulti(option ...Option) error {
101 o := orm.NewOrm()

Callers

nothing calls this directly

Calls 5

TableNameWithPrefixMethod · 0.95
initOptionCacheFunction · 0.85
ExistMethod · 0.45
UpdateMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected