1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 23:46:56 +00:00
kyverno/pkg/engine/jmespath/interface.go

32 lines
719 B
Go
Raw Normal View History

package jmespath
import (
gojmespath "github.com/kyverno/go-jmespath"
"github.com/kyverno/kyverno/pkg/config"
)
type Query interface {
Search(interface{}) (interface{}, error)
}
type Interface interface {
Query(string) (Query, error)
Search(string, interface{}) (interface{}, error)
}
type implementation struct {
functionCaller *gojmespath.FunctionCaller
}
func New(configuration config.Configuration) Interface {
return newImplementation(configuration)
}
func (i implementation) Query(query string) (Query, error) {
return newJMESPath(query, i.functionCaller)
}
func (i implementation) Search(query string, data interface{}) (interface{}, error) {
return newExecution(i.functionCaller, query, data)
}