Skip to content
Snippets Groups Projects
Select Git revision
  • d05cffb65c67cefd72c580a4e1db0b4694a0ee84
  • master default protected
  • v1.23.2
  • v1.23.1
  • v1.23.0
  • v1.22.0
  • v1.21.1
  • v1.21.0
  • v1.20.3
  • v1.20.2
  • v1.20.1
  • v1.20.0
  • v1.19.4
  • v1.19.3
  • v1.19.2
  • v1.19.1
  • v1.19.0
  • v1.18.2
  • v1.18.1
  • v1.18.0
  • v1.17.0
  • v1.16.1
22 results

sugar.go

Blame
  • job-stat.go 1.05 KiB
    // Copyright 2023 schukai GmbH
    // SPDX-License-Identifier: AGPL-3.0
    
    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:"jobId" gorm:"primaryKey"`
    	RunCount     int         `json:"runCount"`
    	SuccessCount int         `json:"successCount"`
    	ErrorCount   int         `json:"errorCount"`
    	TimeMetrics  TimeMetrics `json:"timeMetrics" gorm:"embedded;embeddedPrefix:time_metrics_"`
    
    	CreatedAt time.Time      `gorm:"column:created_at" json:"createdAt" yaml:"createdAt"`
    	UpdatedAt time.Time      `gorm:"column:updated_at" json:"updatedAt" yaml:"updatedAt"`
    	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"
    }