feat: automatic injection parameters

This commit is contained in:
huchenhao 2024-03-20 09:57:12 +08:00
parent dd10c68afb
commit cadbd48538
2 changed files with 0 additions and 4 deletions

View File

@ -39,7 +39,6 @@ func NewFaaSDesc(fnName string, f FaaS) (*FaaSDesc, error) {
for i := 0; i < funcType.NumIn(); i++ { for i := 0; i < funcType.NumIn(); i++ {
paramType := funcType.In(i) paramType := funcType.In(i)
fmt.Println(paramType.Kind(), isFlowType(paramType))
if isFlowType(paramType) { if isFlowType(paramType) {
containsKisflowCtx = true containsKisflowCtx = true
} }

View File

@ -15,9 +15,7 @@ func (f DefaultFaasSerialize) DecodeParam(arr common.KisRowArr, r reflect.Type)
if r.Kind() != reflect.Slice { if r.Kind() != reflect.Slice {
return reflect.Value{}, fmt.Errorf("r must be a slice") return reflect.Value{}, fmt.Errorf("r must be a slice")
} }
slice := reflect.MakeSlice(r, 0, len(arr)) slice := reflect.MakeSlice(r, 0, len(arr))
for _, row := range arr { for _, row := range arr {
var elem reflect.Value var elem reflect.Value
var err error var err error
@ -28,7 +26,6 @@ func (f DefaultFaasSerialize) DecodeParam(arr common.KisRowArr, r reflect.Type)
// 如果失败,则尝试直接反序列化为字符串 // 如果失败,则尝试直接反序列化为字符串
elem, err = decodeString(row) elem, err = decodeString(row)
if err != nil { if err != nil {
fmt.Println("---+++-", row)
// 如果还失败,则尝试先序列化为 JSON 再反序列化 // 如果还失败,则尝试先序列化为 JSON 再反序列化
elem, err = decodeJSON(row, r.Elem()) elem, err = decodeJSON(row, r.Elem())
if err != nil { if err != nil {