(ctx context.Context, f reflect.Value)
| 116 | } |
| 117 | |
| 118 | func funcToPredicate(ctx context.Context, f reflect.Value) Predicate { |
| 119 | t, err := checkSignature(ctx, f.Type(), |
| 120 | []reflect.Type{contextType, nil}, |
| 121 | []reflect.Type{boolType}, |
| 122 | ) |
| 123 | if err != nil { |
| 124 | log.F(ctx, true, "Checking handler signature. Error: %v", err) |
| 125 | } |
| 126 | return func(ctx context.Context, event interface{}) bool { |
| 127 | args := []reflect.Value{reflect.ValueOf(ctx), safeValue(event, t)} |
| 128 | if args[1].Type() != t { |
| 129 | return false |
| 130 | } |
| 131 | result := f.Call(args) |
| 132 | return result[0].Bool() |
| 133 | } |
| 134 | } |
no test coverage detected