24 lines
382 B
Go
24 lines
382 B
Go
|
package ejs
|
||
|
|
||
|
import (
|
||
|
"github.com/tidwall/gjson"
|
||
|
)
|
||
|
|
||
|
type SearchGJsoniString struct {
|
||
|
JsonPath string
|
||
|
CompareMethode string
|
||
|
Value string
|
||
|
}
|
||
|
|
||
|
func (s SearchGJsoniString) match(data []byte) bool {
|
||
|
value := gjson.Get(string(data), s.JsonPath)
|
||
|
switch s.CompareMethode {
|
||
|
case "=":
|
||
|
if value.String() == s.Value {
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
return false
|
||
|
}
|