MCPcopy Index your code
hub / github.com/aiprodcoder/MIXAPI / UpdateOption

Function UpdateOption

model/option.go:167–181  ·  view source on GitHub ↗
(key string, value string)

Source from the content-addressed store, hash-verified

165}
166
167func UpdateOption(key string, value string) error {
168 // Save to database first
169 option := Option{
170 Key: key,
171 }
172 // https://gorm.io/docs/update.html#Save-All-Fields
173 DB.FirstOrCreate(&option, Option{Key: key})
174 option.Value = value
175 // Save is a combination function.
176 // If save value does not contain primary key, it will execute Create,
177 // otherwise it will execute Update (with all fields).
178 DB.Save(&option)
179 // Update OptionMap
180 return updateOptionMap(key, value)
181}
182
183func updateOptionMap(key string, value string) (err error) {
184 common.OptionMapRWMutex.Lock()

Callers 4

PostSetupFunction · 0.92
MigrateConsoleSettingFunction · 0.92
ResetModelRatioFunction · 0.92
UpdateOptionFunction · 0.92

Calls 2

updateOptionMapFunction · 0.85
SaveMethod · 0.80

Tested by

no test coverage detected