026e969b74
- Add 6 TUI screenshots to assets/ (monitors, alerts, logs, nodes, detail, theme) - Rewrite README with hero image, badges, collapsible install sections - Rewrite changelog to match actual CalVer tag history - VHS tooling extracted to lerko/uptop-vhs Reviewed-on: lerko/uptop#32
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)
|
|
}
|