Something went wrong on our end
Select Git revision
job-stat.go
-
Volker Schukai authoredVolker Schukai authored
job-stat.go 1020 B
package jobqueue
import (
"gorm.io/gorm"
"time"
)
// important: if you want to add fields to this struct, you have to add them to the ResetStats() method as well
type JobStats struct {
JobID JobID `json:"job_id" gorm:"primaryKey"`
RunCount int `json:"run_count"`
SuccessCount int `json:"success_count"`
ErrorCount int `json:"error_count"`
TimeMetrics TimeMetrics `json:"time_metrics" gorm:"embedded;embeddedPrefix:time_metrics_"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at" yaml:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at" yaml:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"-" yaml:"-"`
}
type TimeMetrics struct {
AvgRunTime time.Duration `json:"avg"`
MaxRunTime time.Duration `json:"max"`
MinRunTime time.Duration `json:"min"`
TotalRunTime time.Duration `json:"total"`
}
func (JobStats) TableName() string {
return globalTableNamePrefix + "job_stats"
}