Skip to content
Snippets Groups Projects
Select Git revision
  • 0d725e303eccee0a11039942ad86d5b0f5f78720
  • master default protected
  • 1.31
  • 4.38.8
  • 4.38.7
  • 4.38.6
  • 4.38.5
  • 4.38.4
  • 4.38.3
  • 4.38.2
  • 4.38.1
  • 4.38.0
  • 4.37.2
  • 4.37.1
  • 4.37.0
  • 4.36.0
  • 4.35.0
  • 4.34.1
  • 4.34.0
  • 4.33.1
  • 4.33.0
  • 4.32.2
  • 4.32.1
23 results

.jshintc

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"
    }