package pipelines import "errors" type StepType int const ( TypeResizeImageStep StepType = iota TypeCompressImageStep ) type Step struct { Name string `json:"name" faker:"name"` Type StepType `json:"type" faker:"-"` } func (s Step) Translate() (IExecutableStep, error) { var step IExecutableStep switch s.GetType() { case TypeResizeImageStep: step = ResizeImageStep{s} case TypeCompressImageStep: step = CompressImageStep{s} } if step == nil { return nil, errors.New("invalid type") } return step, nil } func (s Step) GetType() StepType { return s.Type } func (s Step) GetName() string { return s.Name }