-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtasks.go
33 lines (29 loc) · 901 Bytes
/
tasks.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
package stepper
import (
"context"
"time"
)
type Task struct {
ID string `json:"_id"`
CustomId string `bson:"custom_id"`
Name string `json:"name"`
Data []byte `json:"data"`
JobId string `json:"jobId"`
Parent string `json:"parent"`
LaunchAt time.Time `json:"launchAt"`
Status string `json:"status"`
LockAt *time.Time `json:"lock_at"`
State []byte `json:"state"`
MiddlewaresState map[string][]byte `json:"middlewares_state"`
EngineContext context.Context `json:"-"`
}
func (t *Task) IsWaiting() bool {
return t.Status == "waiting"
}
type CreateTask struct {
Name string
Data []byte
CustomId string
LaunchAfter time.Duration
LaunchAt time.Time
}