master
Evan Chen 2022-01-09 18:30:35 +08:00
parent 779eb57080
commit 13d3e85317
1 changed files with 6 additions and 5 deletions

View File

@ -65,11 +65,12 @@ func RestoreDefault(key string) error {
}
func Get(key string) string {
var value string
store.DB.
Raw(`select "value" from "attributes" where "key" = ?`, key).
Scan(&value)
return value
a := &Attribute{}
store.DB.Select("value", "default").First(a, "key = ?", key)
if a.Value == "" {
return a.Default
}
return a.Value
}
func Set(key, value string) error {