-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.go
31 lines (28 loc) · 1.04 KB
/
task.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
package models
type Task struct {
UUID string `json:"uuid" gorm:"primaryKey"`
Queue string `json:"queue"`
CurrentState string `json:"current_state"`
AutoTargetState string `json:"auto_target_state"`
SubmitTime int64 `json:"submit_time" gorm:"autoCreateTime:nano"`
UpdateTime int64 `json:"update_time" gorm:"autoUpdateTime:nano"`
Timeout int64 `json:"timeout"`
Priority int64 `json:"priority"`
Payload []byte `json:"payload" gorm:"type:bytea"`
}
type ArchivedTask struct {
UUID string `json:"uuid" gorm:"primaryKey"`
Queue string `json:"queue"`
CurrentState string `json:"current_state"`
AutoTargetState string `json:"auto_target_state"`
SubmitTime int64 `json:"submit_time"`
UpdateTime int64 `json:"update_time" gorm:"autoUpdateTime:nano"`
}
func ConvertTaskForArchive(t Task) (a ArchivedTask) {
a.UUID = t.UUID
a.Queue = t.Queue
a.CurrentState = t.CurrentState
a.AutoTargetState = t.AutoTargetState
a.SubmitTime = t.SubmitTime
return a
}