Files
stalwart-migrator/internal/validate/report.go
T
jcoffey-dev 719a945d64 Initial commit: stalwart-migrator design and scaffolding
In-place upgrade tool for Stalwart Mail Server (0.15.5 -> latest) with
checkpointed rollback and post-migration validation. Design stage; see
ARCHITECTURE.md.
2026-08-22 18:17:17 -07:00

41 lines
604 B
Go

package validate
import (
"fmt"
"strings"
)
type Status string
const (
StatusOK Status = "ok"
StatusFail Status = "fail"
)
type CheckResult struct {
Name string
Status Status
Detail string
}
type Report struct {
Results []CheckResult
}
func (r Report) Blocking() bool {
for _, res := range r.Results {
if res.Status == StatusFail {
return true
}
}
return false
}
func (r Report) String() string {
var b strings.Builder
for _, res := range r.Results {
fmt.Fprintf(&b, "[%-4s] %-16s %s\n", strings.ToUpper(string(res.Status)), res.Name, res.Detail)
}
return b.String()
}