kis-flow/function/kis_function_e.go

33 lines
659 B
Go
Raw Normal View History

2023-12-31 18:04:28 +08:00
package function
import (
"context"
2024-03-26 14:54:50 +08:00
"github.com/aceld/kis-flow/kis"
"github.com/aceld/kis-flow/log"
2023-12-31 18:04:28 +08:00
)
type KisFunctionE struct {
BaseFunction
}
2024-01-26 17:27:29 +08:00
func NewKisFunctionE() kis.Function {
f := new(KisFunctionE)
// 初始化metaData
f.metaData = make(map[string]interface{})
return f
}
2024-01-01 17:49:27 +08:00
func (f *KisFunctionE) Call(ctx context.Context, flow kis.Flow) error {
2024-04-15 11:17:47 +08:00
log.Logger().DebugF("KisFunctionE, flow = %+v\n", flow)
2023-12-31 18:04:28 +08:00
2024-01-04 16:36:36 +08:00
// 通过KisPool 路由到具体的执行计算Function中
if err := kis.Pool().CallFunction(ctx, f.Config.FName, flow); err != nil {
2024-04-15 11:17:47 +08:00
log.Logger().ErrorFX(ctx, "Function Called Error err = %s\n", err)
2024-01-04 16:36:36 +08:00
return err
2024-01-03 17:22:35 +08:00
}
2023-12-31 18:04:28 +08:00
return nil
}