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.
27 lines
656 B
27 lines
656 B
package processors
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"gitea.anxinyun.cn/container/common_models"
|
|
"log"
|
|
)
|
|
|
|
type GroupProcess struct {
|
|
name string
|
|
}
|
|
|
|
func NewGroupProcess(name string) *Process {
|
|
return &Process{name: name}
|
|
}
|
|
|
|
// Process 分组处理者 , ProcessData -> PhyData
|
|
func (p *GroupProcess) Process(ctx context.Context, params any) (any, error) {
|
|
log.Printf("[%s]开始执行", p.name)
|
|
if ProcessData, ok := params.(*common_models.ProcessData); !ok {
|
|
return nil, errors.New("不是[PhyData]类型数据")
|
|
} else {
|
|
log.Printf("[%s]-[%s]处理...", ProcessData.DeviceData.DeviceId, ProcessData.DeviceData.Name)
|
|
return ProcessData, nil
|
|
}
|
|
}
|
|
|