kis-flow/function/kis_function_c.go

33 lines
624 B
Go
Raw Normal View History

2023-12-31 18:04:28 +08:00
package function
import (
"context"
2024-01-01 17:49:27 +08:00
"kis-flow/kis"
2024-01-02 15:38:51 +08:00
"kis-flow/log"
2023-12-31 18:04:28 +08:00
)
type KisFunctionC struct {
BaseFunction
}
2024-01-26 17:27:29 +08:00
func NewKisFunctionC() kis.Function {
f := new(KisFunctionC)
// 初始化metaData
f.metaData = make(map[string]interface{})
return f
}
2024-01-01 17:49:27 +08:00
func (f *KisFunctionC) Call(ctx context.Context, flow kis.Flow) error {
2024-01-02 15:38:51 +08:00
log.Logger().InfoF("KisFunctionC, 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 {
log.Logger().ErrorFX(ctx, "Function Called Error err = %s\n", err)
return err
2024-01-03 17:22:35 +08:00
}
2023-12-31 18:04:28 +08:00
return nil
}