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
592 B
27 lines
592 B
1 month ago
|
package processors
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"errors"
|
||
|
"gitea.anxinyun.cn/container/common_models"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
type Process struct {
|
||
|
name string
|
||
|
}
|
||
|
|
||
|
func NewProcess(name string) *Process {
|
||
|
return &Process{name: name}
|
||
|
}
|
||
|
|
||
|
func (p *Process) 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("不是[DeviceData]类型数据")
|
||
|
} else {
|
||
|
log.Printf("[%s]-[%s]处理...", ProcessData.DeviceData.DeviceId, ProcessData.DeviceData.Name)
|
||
|
return ProcessData, nil
|
||
|
}
|
||
|
}
|