Skip to content

Commit

Permalink
add ContainsStr built-in function
Browse files Browse the repository at this point in the history
  • Loading branch information
reynieroz committed Jan 24, 2024
1 parent 7272ef7 commit 5757dc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ast/BuiltInFunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
package ast

import (
"github.com/hyperjumptech/grule-rule-engine/logger"
"math"
"reflect"
"slices"
"strings"
"time"

"github.com/hyperjumptech/grule-rule-engine/logger"
"github.com/hyperjumptech/grule-rule-engine/pkg"
)

Expand Down Expand Up @@ -537,3 +538,8 @@ func (gf *BuiltInFunctions) Trunc(x float64) float64 {

return math.Trunc(x)
}

// ContainsStr is a wrapper function for slices.Contains function for string
func (gf *BuiltInFunctions) ContainsStr(s []string, v string) bool {
return slices.Contains(s, v)
}

0 comments on commit 5757dc3

Please sign in to comment.