archived_jobs

package
v0.0.0-...-453881e Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 10 Imported by: 4

Documentation

Overview

Logic for interacting with the "archived_jobs" table.

Index

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:

func GetRetry

func GetRetry(id types.PrefixUUID, attempts uint8) (job *models.ArchivedJob, err error)

GetRetry attempts to retrieve the job attempts times before giving up.

func Setup

func Setup() (err error)

Setup prepares all database statements.

Types

This section is empty.

Jump to

Keyboard shortcuts

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