03cbe283df
Rework the VHS demo so the README screenshots actually entice a download. Demo data / tooling: - seed.yaml: real, reachable service URLs (detail now shows nextcloud.com, not example.com); Auth Portal -> non-resolving home.arpa host so it reads as a believable, reliably-DOWN monitor - backfill: transient outages for Nextcloud/Jellyfin/Immich aligned with their state changes (uptime % now matches); log timestamps derived from now so the Logs view reads chronologically; real SSL warning; three probe nodes across regions; seeded alert send health - demo.tape: shorter warm-up, added Nodes + theme captures, ordered so every shot stays inside the 60s node-freshness window (consistent probe count) - vhs/crop: new tool to trim the empty terminal border around each screenshot - setup.sh: build backfill up front for deterministic timing; UPTOP_DEMO=1 Supporting code: - persist alert send health (new alert_health table, load on startup, best-effort save on send) so health/last-sent survive restarts - latency Min/Avg/Max ignore failed checks (no more "Min 0ms") - correct "probe"/"probes" pluralization - stable status dot instead of an animated spinner under UPTOP_DEMO
37 lines
699 B
Go
37 lines
699 B
Go
package store
|
|
|
|
import (
|
|
"database/sql"
|
|
"strconv"
|
|
)
|
|
|
|
type Dialect interface {
|
|
DriverName() string
|
|
CreateTablesSQL() []string
|
|
MigrationsSQL() []string
|
|
BoolFalse() string
|
|
ResetSequenceOnEmpty(db *sql.DB, table string)
|
|
ImportWipe(tx *sql.Tx)
|
|
ImportResetSequences(tx *sql.Tx)
|
|
UpsertNodeSQL() string
|
|
UpsertAlertHealthSQL() string
|
|
}
|
|
|
|
func rewritePlaceholders(query string, dollarStyle bool) string {
|
|
if !dollarStyle {
|
|
return query
|
|
}
|
|
buf := make([]byte, 0, len(query)+32)
|
|
n := 0
|
|
for i := 0; i < len(query); i++ {
|
|
if query[i] == '?' {
|
|
n++
|
|
buf = append(buf, '$')
|
|
buf = append(buf, []byte(strconv.Itoa(n))...)
|
|
} else {
|
|
buf = append(buf, query[i])
|
|
}
|
|
}
|
|
return string(buf)
|
|
}
|