Micro-service for file storage and processing written in Go
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.
 
 

39 lines
611 B

package pipelines
import "errors"
type StepType int
const (
TypeResizeImageStep StepType = iota
TypeCompressImageStep
)
type Step struct {
Name string `faker:"name"`
Type StepType `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
}