Add and fix nlreturn (new line return)

This commit is contained in:
Kristoffer Dalby 2021-11-14 16:46:09 +01:00
parent d0ef850035
commit 89eb13c6cb
No known key found for this signature in database
GPG key ID: 09F62DC067465735
25 changed files with 198 additions and 1 deletions

4
db.go
View file

@ -50,6 +50,7 @@ func (h *Headscale) initDB() error {
}
err = h.setValue("db_version", dbVersion)
return err
}
@ -93,6 +94,7 @@ func (h *Headscale) getValue(key string) (string, error) {
) {
return "", errors.New("not found")
}
return row.Value, nil
}
@ -106,9 +108,11 @@ func (h *Headscale) setValue(key string, value string) error {
_, err := h.getValue(key)
if err == nil {
h.db.Model(&kv).Where("key = ?", key).Update("value", value)
return nil
}
h.db.Create(kv)
return nil
}