@@ -57,6 +57,8 @@ type HandleP3Func[P1, P2, P3 interface{}] func(ctx context.Context, p1 P1, p2 P2
57
57
58
58
type HandleP4Func [P1 , P2 , P3 , P4 interface {}] func (ctx context.Context , p1 P1 , p2 P2 , p3 P3 , p4 P4 ) (bool , error )
59
59
60
+ type HandleP5Func [P1 , P2 , P3 , P4 , P5 interface {}] func (ctx context.Context , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 ) (bool , error )
61
+
60
62
type HandleP9Func [P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8 , P9 interface {}] func (ctx context.Context , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 , p6 P6 , p7 P7 , p8 P8 , p9 P9 ) (bool , error )
61
63
62
64
func HandleP0 (ctx context.Context , handler ... HandleP0Func ) (bool , error ) {
@@ -185,6 +187,36 @@ func HandleP4WithCondition[P1, P2, P3, P4 interface{}](ctx context.Context, cond
185
187
return WithCondition (conditions , condition , changed , err )
186
188
}
187
189
190
+ func HandleP5 [P1 , P2 , P3 , P4 , P5 interface {}](ctx context.Context , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 , handler ... HandleP5Func [P1 , P2 , P3 , P4 , P5 ]) (bool , error ) {
191
+ isChanged := false
192
+ for _ , h := range handler {
193
+ changed , err := h (ctx , p1 , p2 , p3 , p4 , p5 )
194
+ if changed {
195
+ isChanged = true
196
+ }
197
+
198
+ if err != nil {
199
+ return isChanged , err
200
+ }
201
+ }
202
+
203
+ return isChanged , nil
204
+ }
205
+
206
+ func HandleP5WithStop [P1 , P2 , P3 , P4 , P5 interface {}](ctx context.Context , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 , handler ... HandleP5Func [P1 , P2 , P3 , P4 , P5 ]) (bool , error ) {
207
+ changed , err := HandleP5 [P1 , P2 , P3 , P4 , P5 ](ctx , p1 , p2 , p3 , p4 , p5 , handler ... )
208
+ if IsStop (err ) {
209
+ return changed , nil
210
+ }
211
+
212
+ return changed , err
213
+ }
214
+
215
+ func HandleP5WithCondition [P1 , P2 , P3 , P4 , P5 interface {}](ctx context.Context , conditions * api.ConditionList , condition api.ConditionType , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 , handler ... HandleP5Func [P1 , P2 , P3 , P4 , P5 ]) (bool , error ) {
216
+ changed , err := HandleP5 [P1 , P2 , P3 , P4 , P5 ](ctx , p1 , p2 , p3 , p4 , p5 , handler ... )
217
+ return WithCondition (conditions , condition , changed , err )
218
+ }
219
+
188
220
func HandleP9 [P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8 , P9 interface {}](ctx context.Context , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 , p6 P6 , p7 P7 , p8 P8 , p9 P9 , handler ... HandleP9Func [P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8 , P9 ]) (bool , error ) {
189
221
isChanged := false
190
222
for _ , h := range handler {
@@ -209,3 +241,8 @@ func HandleP9WithStop[P1, P2, P3, P4, P5, P6, P7, P8, P9 interface{}](ctx contex
209
241
210
242
return changed , err
211
243
}
244
+
245
+ func HandleP9WithCondition [P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8 , P9 interface {}](ctx context.Context , conditions * api.ConditionList , condition api.ConditionType , p1 P1 , p2 P2 , p3 P3 , p4 P4 , p5 P5 , p6 P6 , p7 P7 , p8 P8 , p9 P9 , handler ... HandleP9Func [P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8 , P9 ]) (bool , error ) {
246
+ changed , err := HandleP9 [P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8 , P9 ](ctx , p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 , p9 , handler ... )
247
+ return WithCondition (conditions , condition , changed , err )
248
+ }
0 commit comments