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

Method FindByKey

models/options.go:63–75  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

61}
62
63func (p *Option) FindByKey(key string) (*Option, error) {
64
65 if val, ok := optionCache.Load(key); ok {
66 p = val.(*Option)
67 return p, nil
68 }
69
70 o := orm.NewOrm()
71 if err := o.QueryTable(p).Filter("option_name", key).One(p); err != nil {
72 return p, err
73 }
74 return p, nil
75}
76
77func GetOptionValue(key, def string) string {
78 if option, err := NewOption().FindByKey(key); err == nil {

Callers 5

ContentMethod · 0.80
PrepareMethod · 0.80
CreateMethod · 0.80
CopyMethod · 0.80
GetOptionValueFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected