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 { func Get(key string) string {
var value string a := &Attribute{}
store.DB. store.DB.Select("value", "default").First(a, "key = ?", key)
Raw(`select "value" from "attributes" where "key" = ?`, key). if a.Value == "" {
Scan(&value) return a.Default
return value }
return a.Value
} }
func Set(key, value string) error { func Set(key, value string) error {