AFAIRE
sdk
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### sdk ####### Copyright (c) 2021 losyme ###################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package factory
import "forge.chapril.org/dune/jw"
type Model interface {
CreateJob(job *jw.Job) (*jw.Job, error)
CreateWorkflow(wf *jw.Workflow) (*jw.Workflow, error)
}
type Factory struct {
model Model
}
func New(model Model) *Factory {
return &Factory{
model: model,
}
}
func (f *Factory) NewJob(namespace, _type string) *Job {
return &Job{
job: jw.NewJob(namespace, _type),
model: f.model,
}
}
func (f *Factory) NewWorkflow(firstStep string, allSteps map[string]*jw.Step) *Workflow {
return &Workflow{
wf: jw.NewWorkflow(firstStep, allSteps),
model: f.model,
}
}
/*
######################################################################################################## @(°_°)@ #######
*/