Skip to content

Commit

Permalink
Merge pull request kform-dev#15 from faebr/fix/for-each
Browse files Browse the repository at this point in the history
added case for []string in forEach loop
  • Loading branch information
henderiw authored Jul 15, 2024
2 parents 66081a5 + 2d02ebd commit 57a581d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/exec/fn/fns/block_exec_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ func (r *ExecHandler) getLoopItems(ctx context.Context, attr *kformv1alpha1.Attr
}
log.Debug("getLoopItems forEach render output", "value type", reflect.TypeOf(v), "value", v)
switch v := v.(type) {
case []string:
// in a list we return key = int, val = any
for k, v := range v {
log.Debug("getLoopItems forEach insert item", "k", k, "v", v)
items.Add(k, item{key: k, val: v})
}
case []any:
// in a list we return key = int, val = any
for k, v := range v {
Expand Down

0 comments on commit 57a581d

Please sign in to comment.