39 строки
977 B
Go
39 строки
977 B
Go
// Package checkresult holds the DB-free outcome of a single check execution.
|
|
package checkresult
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// CheckResult is the in-memory outcome of a single check execution.
|
|
// The check packages build a CheckResult, then call SaveTo to persist
|
|
// state, error, warnings, infos, and expiry back to the check row.
|
|
type CheckResult struct {
|
|
State string
|
|
Error error
|
|
Warnings []string
|
|
Infos []string
|
|
Duration time.Duration
|
|
Expires *time.Time
|
|
}
|
|
|
|
// GetState returns the result state (OK/ERR/FAIL/WARN).
|
|
func (r *CheckResult) GetState() string {
|
|
return r.State
|
|
}
|
|
|
|
// GetError returns the result error, if any.
|
|
func (r *CheckResult) GetError() error {
|
|
return r.Error
|
|
}
|
|
|
|
// GetWarnings returns the human-readable warnings produced by the check.
|
|
func (r *CheckResult) GetWarnings() []string {
|
|
return r.Warnings
|
|
}
|
|
|
|
// GetInfos returns the human-readable info messages produced by the check.
|
|
func (r *CheckResult) GetInfos() []string {
|
|
return r.Infos
|
|
}
|