Skip to content

Commit

Permalink
feat: add stringFormat for gval function.
Browse files Browse the repository at this point in the history
  • Loading branch information
xufeixiang committed Nov 18, 2024
1 parent e08c2a9 commit 25a3a3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/engine/directives/variable_injectrulevalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func init() {
gval.Function("stringContains", func(a, b string) bool {
return strings.Contains(a, b)
}),
gval.Function("stringFormat", func(a string, args ...any) string {
return fmt.Sprintf(a, args...)
}),
gval.Function("arrayContains", func(a []any, b any) bool {
return slices.ContainsFunc(a, func(aa any) bool {
return fmt.Sprintf("%v", aa) == fmt.Sprintf("%v", b)
Expand Down

0 comments on commit 25a3a3b

Please sign in to comment.