forked from harness/harness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobs.go
43 lines (32 loc) · 1.03 KB
/
jobs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package store
import (
"github.com/drone/drone/model"
"golang.org/x/net/context"
)
type JobStore interface {
// Get gets a job by unique ID.
Get(int64) (*model.Job, error)
// GetNumber gets a job by number.
GetNumber(*model.Build, int) (*model.Job, error)
// GetList gets a list of all users in the system.
GetList(*model.Build) ([]*model.Job, error)
// Create creates a job.
Create(*model.Job) error
// Update updates a job.
Update(*model.Job) error
}
func GetJob(c context.Context, id int64) (*model.Job, error) {
return FromContext(c).Jobs().Get(id)
}
func GetJobNumber(c context.Context, build *model.Build, num int) (*model.Job, error) {
return FromContext(c).Jobs().GetNumber(build, num)
}
func GetJobList(c context.Context, build *model.Build) ([]*model.Job, error) {
return FromContext(c).Jobs().GetList(build)
}
func CreateJob(c context.Context, job *model.Job) error {
return FromContext(c).Jobs().Create(job)
}
func UpdateJob(c context.Context, job *model.Job) error {
return FromContext(c).Jobs().Update(job)
}