minor changes to table.go

This commit is contained in:
Pablu23
2024-04-04 21:36:12 +02:00
parent 56fc884952
commit 620a043286
3 changed files with 48 additions and 9 deletions

View File

@@ -58,8 +58,17 @@ func loadSettings(db *sql.DB) (map[string]Setting, error) {
return res, err
}
type IgnoreDeleteError struct{}
func (m IgnoreDeleteError) Error() string {
return "Should ignore deletion"
}
func deleteSetting(db *sql.DB, key string) error {
const cmd = "UPDATE Setting set Value = DefaultValue WHERE Name = ?"
_, err := db.Exec(cmd, key)
return err
if err != nil {
return err
}
return IgnoreDeleteError{}
}