software steht so weit.

jetzt build + docker build und testen
This commit is contained in:
br committed 2026-10-02 13:25:34 +02:00
1 parent 42f0c0accb
commit ca6cdcca63
90 files changed
+10298 -480

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package store
import (
"context"
"database/sql"
"errors"
"fmt"
)
// Setting liest eine Server-Einstellung (ErrNotFound, wenn nicht gesetzt).
func (s *Store) Setting(ctx context.Context, key string) (string, error) {
var v string
err := s.db.QueryRowContext(ctx, `SELECT value FROM settings WHERE key = ?`, key).Scan(&v)
if errors.Is(err, sql.ErrNoRows) {
return "", fmt.Errorf("Einstellung %s: %w", key, ErrNotFound)
}
return v, err
}
// SetSetting setzt bzw. überschreibt eine Server-Einstellung.
func (s *Store) SetSetting(ctx context.Context, key, value string) error {
if blank(key) {
return invalid("Schlüssel fehlt")
}
_, err := s.db.ExecContext(ctx,
`INSERT INTO settings (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value`,
key, value)
return err
}