Documentation ¶
Index ¶
- func MatchSelectors(obj map[string]string, selectors ...Interface) (bool, error)
- type DefaultSelector
- type Interface
- type JSONSchemaSelector
- func NewJSONSchemaSelector(scheme *gojsonschema.Schema) JSONSchemaSelector
- func NewJSONSchemaSelectorFromBytes(src []byte) (JSONSchemaSelector, error)
- func NewJSONSchemaSelectorFromGoStruct(src interface{}) (JSONSchemaSelector, error)
- func NewJSONSchemaSelectorFromString(src string) (JSONSchemaSelector, error)
- type RegexSelector
- type SelectorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DefaultSelector ¶
type DefaultSelector map[string]interface{}
DefaultSelector defines the selector for the identity of an object. The default selector is a map of identity key to selector All keys are validated against the given selector.
Valid selectors are - raw string value: identity value is compared to the selector value - array of strings: or-operator identity value must be one of the defined strings in the array.
func ParseDefaultSelector ¶
func ParseDefaultSelector(value interface{}) (DefaultSelector, error)
ParseDefaultSelector creates a Identity selector from a - json encoded selector - map[string]Selector
A selector can be - a string: the value is directly matched - a array of strings: one selector in the array must match.
type JSONSchemaSelector ¶
type JSONSchemaSelector struct {
Scheme *gojsonschema.Schema
}
JSONSchemaSelector uses a jsonschema to match a specific object.
func NewJSONSchemaSelector ¶
func NewJSONSchemaSelector(scheme *gojsonschema.Schema) JSONSchemaSelector
NewJSONSchemaSelector creates a new jsonschema selector from a gojsonschema.
func NewJSONSchemaSelectorFromBytes ¶
func NewJSONSchemaSelectorFromBytes(src []byte) (JSONSchemaSelector, error)
NewJSONSchemaSelectorFromBytes creates a new jsonschema selector from a gojsonschema.
func NewJSONSchemaSelectorFromGoStruct ¶
func NewJSONSchemaSelectorFromGoStruct(src interface{}) (JSONSchemaSelector, error)
NewJSONSchemaSelectorFromString creates a new jsonschema selector from a gojsonschema.
func NewJSONSchemaSelectorFromString ¶
func NewJSONSchemaSelectorFromString(src string) (JSONSchemaSelector, error)
NewJSONSchemaSelectorFromString creates a new jsonschema selector from a gojsonschema.
type RegexSelector ¶
type RegexSelector map[string]interface{}
RegexSelector defines the selector for the identity of an object. The regex selector is a map of identity key to selector All keys are validated against the given selector.
Valid selectors are - raw string value: identity value is compared to the selector value - array of strings: or-operator identity value must be one of the defined strings in the array.
func ParseRegexSelector ¶
func ParseRegexSelector(value interface{}) (RegexSelector, error)
ParseRegexSelector creates a Identity selector from a - json encoded selector - map[string]Selector
A selector can be - a string: the value is directly matched - a array of strings: one selector in the array must match.