Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidatePort ¶
ValidatePort validates that a port number is valid
func ValidateRequired ¶
ValidateRequired validates that a string field is not empty
Types ¶
type HealthStatus ¶
type HealthStatus struct {
Healthy bool `json:"healthy"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
Details map[string]interface{} `json:"details,omitempty"`
}
HealthStatus represents the health status of a service or component
func NewHealthStatus ¶
func NewHealthStatus(healthy bool, message string) *HealthStatus
NewHealthStatus creates a new HealthStatus instance
func NewHealthStatusWithDetails ¶
func NewHealthStatusWithDetails(healthy bool, message string, details map[string]interface{}) *HealthStatus
NewHealthStatusWithDetails creates a new HealthStatus instance with details
type Result ¶
type Result struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
Result represents the result of an operation
func ErrorFromErr ¶
ErrorFromErr creates an error result from a Go error
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Port int `json:"port"`
Status ServiceStatus `json:"status"`
StartTime time.Time `json:"start_time"`
LastHealthCheck time.Time `json:"last_health_check"`
}
ServiceInfo contains information about a service
func NewServiceInfo ¶
func NewServiceInfo(name, version string, port int) *ServiceInfo
NewServiceInfo creates a new ServiceInfo instance
func (*ServiceInfo) SetStatus ¶
func (s *ServiceInfo) SetStatus(status ServiceStatus)
SetStatus updates the service status and health check timestamp
func (*ServiceInfo) Uptime ¶
func (s *ServiceInfo) Uptime() time.Duration
Uptime returns the duration since the service started
type ServiceStatus ¶
type ServiceStatus int
ServiceStatus represents the current status of a service
const ( ServiceStatusStarting ServiceStatus = iota ServiceStatusHealthy ServiceStatusUnhealthy ServiceStatusStopping ServiceStatusStopped )
func (ServiceStatus) String ¶
func (s ServiceStatus) String() string
String returns the string representation of ServiceStatus