16 lines
270 B
Go
16 lines
270 B
Go
|
package filter
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/jmespath/go-jmespath"
|
||
|
)
|
||
|
|
||
|
func BuildExpression(expressionStr string) (*jmespath.JMESPath, error) {
|
||
|
expr, err := jmespath.Compile(fmt.Sprintf("[?%s]", expressionStr))
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return expr, nil
|
||
|
}
|