24 lines
1.1 KiB
Go
24 lines
1.1 KiB
Go
package workflow
|
|
|
|
import "time"
|
|
|
|
// WorkflowSchedule is a struct that contains the scheduling information of a workflow
|
|
type ScheduleMode int
|
|
|
|
const (
|
|
TASK ScheduleMode = iota
|
|
SERVICE
|
|
)
|
|
|
|
/*
|
|
* WorkflowSchedule is a struct that contains the scheduling information of a workflow
|
|
* It contains the mode of the schedule (Task or Service), the name of the schedule, the start and end time of the schedule and the cron expression
|
|
*/
|
|
type WorkflowSchedule struct {
|
|
Mode int64 `json:"mode" bson:"mode" validate:"required"` // Mode is the mode of the schedule (Task or Service)
|
|
Name string `json:"name" bson:"name" validate:"required"` // Name is the name of the schedule
|
|
Start *time.Time `json:"start" bson:"start" validate:"required,ltfield=End"` // Start is the start time of the schedule, is required and must be less than the End time
|
|
End *time.Time `json:"end,omitempty" bson:"end,omitempty"` // End is the end time of the schedule
|
|
Cron string `json:"cron,omitempty" bson:"cron,omitempty"` // here the cron format : ss mm hh dd MM dw task
|
|
}
|