mirror of
https://github.com/aceld/kis-flow.git
synced 2025-01-23 07:30:23 +08:00
27 lines
667 B
Go
27 lines
667 B
Go
package faas
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/aceld/kis-flow/kis"
|
|
)
|
|
|
|
// type FaaS func(context.Context, Flow) error
|
|
|
|
func DataReuseFuncHandler(ctx context.Context, flow kis.Flow) error {
|
|
fmt.Println("---> Call DataReuseFuncHandler ----")
|
|
|
|
for index, row := range flow.Input() {
|
|
str := fmt.Sprintf("In FuncName = %s, FuncId = %s, row = %s", flow.GetThisFuncConf().FName, flow.GetThisFunction().GetId(), row)
|
|
fmt.Println(str)
|
|
|
|
// 计算结果数据
|
|
resultStr := fmt.Sprintf("data from funcName[%s], index = %d", flow.GetThisFuncConf().FName, index)
|
|
|
|
// 提交结果数据
|
|
_ = flow.CommitRow(resultStr)
|
|
}
|
|
|
|
return flow.Next(kis.ActionDataReuse)
|
|
}
|