Documentation
¶
Overview ¶
Logic for interacting with the "archived_jobs" table.
Index ¶
- Constants
- Variables
- func Create(id types.PrefixUUID, name string, status models.JobStatus, attempt uint8) (*models.ArchivedJob, error)
- func Get(id types.PrefixUUID) (*models.ArchivedJob, error)
- func GetRetry(id types.PrefixUUID, attempts uint8) (job *models.ArchivedJob, err error)
- func Setup() (err error)
Examples ¶
Constants ¶
View Source
const Prefix = "job_"
Variables ¶
View Source
var ErrNotFound = errors.New("Archived job not found")
ErrNotFound indicates that the archived job was not found.
Functions ¶
func Create ¶
func Create(id types.PrefixUUID, name string, status models.JobStatus, attempt uint8) (*models.ArchivedJob, error)
Create an archived job with the given id, status, and attempts. Assumes that the job already exists in the queued_jobs table; the `data` field is copied from there. If the job does not exist, queued_jobs.ErrNotFound is returned.
Example ¶
id, _ := types.NewPrefixUUID("job_6740b44e-13b9-475d-af06-979627e0e0d6") aj, _ := Create(id, "echo", models.StatusSucceeded, 3) fmt.Println(aj.ID.String())
Output:
func Get ¶
func Get(id types.PrefixUUID) (*models.ArchivedJob, error)
Get returns the archived job with the given id, or sql.ErrNoRows if it's not present.
Example ¶
id, _ := types.NewPrefixUUID("job_6740b44e-13b9-475d-af06-979627e0e0d6") aj, _ := Get(id) fmt.Println(aj.ID.String())
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.