Skip to content

Commit

Permalink
feat string operations
Browse files Browse the repository at this point in the history
  • Loading branch information
baxiry committed Jul 23, 2024
1 parent cf2d923 commit fe5845c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions engine/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ func match(filter gjson.Result, data string, ids ...int64) (result bool, err err
}
return result

case "$nst": // start with ..
if strings.HasPrefix(dataVal.Str, sQueryVal.Str) {
result = false
}
return result

case "$nen": // end with ..
if strings.HasSuffix(dataVal.Str, sQueryVal.Str) {
result = false
}
return result

case "$nc": // contains ..
if strings.Contains(dataVal.Str, sQueryVal.Str) {
result = false
}
return result

default:

err = fmt.Errorf("unknown %s operation", sQueryKey.Str)
Expand Down

0 comments on commit fe5845c

Please sign in to comment.