import ( "github.com/pingcap/tidb/model" "fmt" ) jobState := model.JobStateRunning fmt.Println(jobState.String()) // Running
import ( "github.com/pingcap/tidb/model" "fmt" ) jobState := model.JobStateDone if jobState.IsCompleted() { fmt.Println("Job is completed.") } else if jobState.IsCanceled() { fmt.Println("Job is canceled.") } else if jobState.IsFailed() { fmt.Println("Job has failed.") } else { fmt.Println("Job is still running.") }In this example, the IsCompleted(), IsCanceled(), and IsFailed() methods are used to determine the current status of the job. Depending on the result of these methods, a message is displayed indicating whether the job has completed successfully, been canceled, or encountered an error.