mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-22 17:57:31 +00:00
Add and fix nlreturn (new line return)
This commit is contained in:
4
db.go
4
db.go
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user