model

package
v0.0.0-...-9172df8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Failed    = "Failed"
	Succeeded = "Succeeded"
	Retry     = "Retry"
	Cancelled = "Cancelled"
	Running   = "Running"
)

Result constants

Variables

This section is empty.

Functions

This section is empty.

Types

type DBJobService

type DBJobService struct {
	// contains filtered or unexported fields
}

DBJobService ...

func NewJobService

func NewJobService(d *sqlx.DB, p string) *DBJobService

NewJobService ...

func (*DBJobService) GetJobs

func (s *DBJobService) GetJobs() ([]*Job, error)

GetJobs ... Fetch latest job data from database.

type DBOutcomeService

type DBOutcomeService struct {
	// contains filtered or unexported fields
}

DBOutcomeService ...

func NewOutcomeService

func NewOutcomeService(db *sqlx.DB, p string) *DBOutcomeService

NewOutcomeService ...

func (*DBOutcomeService) AllSince

func (o *DBOutcomeService) AllSince(dt int) ([]*Outcome, error)

AllSince ... Fetch job outcomes since given date

func (*DBOutcomeService) GetOutcome

func (o *DBOutcomeService) GetOutcome(q OutcomeQuery) ([]*Outcome, error)

GetOutcome ... Fetch job run outcome details

type Job

type Job struct {
	ID              string      `db:"JobID" json:"job_id"`
	Name            string      `db:"JobName" json:"name"`
	Scheduled       bool        `db:"Scheduled" json:"scheduled"`
	Run             null.Time   `db:"LastRunDate" json:"run_date"`
	Duration        null.Float  `db:"DurationInSec" json:"run_duration"`
	AverageDuration null.Float  `db:"AvgDurationInSec" json:"avg_run_duration"`
	Result          null.String `db:"LastRunResult" json:"run_result"`
	NextRun         null.Time   `db:"NextRunDate" json:"next_run"`
}

Job ...

func (*Job) NextCheck

func (j *Job) NextCheck() time.Time

NextCheck ...

type Outcome

type Outcome struct {
	InstanceID       int         `db:"instance_id"`
	JobID            []byte      `db:"job_id"`
	JobName          string      `db:"job_name"`
	StepID           int         `db:"step_id"`
	StepName         string      `db:"step_name"`
	SQLMessageID     int         `db:"sql_message_id"`
	SQLSeverity      int         `db:"sql_severity"`
	Message          string      `db:"message"`
	RunStatus        string      `db:"run_status"`
	RunDate          time.Time   `db:"run_date"`
	RunDuration      int         `db:"run_duration"`
	OperatorEmailed  null.String `db:"operator_emailed"`
	OperatorNetsent  null.String `db:"operator_netsent"`
	OperatorPaged    null.String `db:"operator_paged"`
	RetriesAttempted int         `db:"retries_attempted"`
	Server           string      `db:"server"`
}

Outcome ... Record from: exec dbo.sp_help_jobhistory @job_id = <job_id>, @start_run_date = <start_dt>, @start_run_time = <start_tm>, @oldest_first = 1, @mode = 'FULL';

type OutcomeQuery

type OutcomeQuery struct {
	JobID        string
	StartRunDate int // e.g. 20170724
	StartRunTime int // e.g. 91500 or 100500
}

OutcomeQuery ... Structures data required to get an Outcome

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL