anchor

package
v1.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsCondition added in v1.6.0

func ContainsCondition(a Anchor) bool

ContainsCondition returns true if anchor is either condition anchor or global condition anchor

func GetAnchorsResourcesFromMap added in v1.1.0

func GetAnchorsResourcesFromMap(patternMap map[string]interface{}) (map[string]interface{}, map[string]interface{})

GetAnchorsResourcesFromMap returns maps of anchors and resources

func IsAddIfNotPresent added in v1.10.0

func IsAddIfNotPresent(a Anchor) bool

IsAddIfNotPresent checks for addition anchor

func IsCondition added in v1.10.0

func IsCondition(a Anchor) bool

IsCondition checks for condition anchor

func IsConditionalAnchorError added in v1.6.0

func IsConditionalAnchorError(err error) bool

IsConditionalAnchorError checks if error is a conditional anchor error

func IsEquality added in v1.10.0

func IsEquality(a Anchor) bool

IsEquality checks for equality anchor

func IsExistence added in v1.10.0

func IsExistence(a Anchor) bool

IsExistence checks for existence anchor

func IsGlobal added in v1.10.0

func IsGlobal(a Anchor) bool

IsGlobal checks for global condition anchor

func IsGlobalAnchorError added in v1.6.0

func IsGlobalAnchorError(err error) bool

IsGlobalAnchorError checks if error is a global global anchor error

func IsNegation added in v1.10.0

func IsNegation(a Anchor) bool

IsNegation checks for negation anchor

func IsNegationAnchorError added in v1.6.0

func IsNegationAnchorError(err error) bool

IsNegationAnchorError checks if error is a negation anchor error

func IsOneOf added in v1.10.0

func IsOneOf(a Anchor, types ...AnchorType) bool

IsOneOf returns checks if anchor is one of the given types

func RemoveAnchorsFromPath added in v1.6.0

func RemoveAnchorsFromPath(str string) string

RemoveAnchorsFromPath removes all anchor from path string

func String added in v1.10.0

func String(modifier AnchorType, key string) string

String returns the anchor string. Will return an empty string if key is empty.

Types

type Anchor added in v1.10.0

type Anchor interface {
	// Type returns the anchor type
	Type() AnchorType
	// Key returns the anchor key
	Key() string
	// String returns the anchor string
	String() string
}

Anchor interface

func New added in v1.10.0

func New(modifier AnchorType, key string) Anchor

New creates an anchor

func Parse added in v1.10.0

func Parse(str string) Anchor

Parse parses a string, returns nil if not an anchor

type AnchorMap added in v1.10.0

type AnchorMap struct {

	// AnchorError - used in validate to break execution of the recursion when if condition fails
	AnchorError validateAnchorError
	// contains filtered or unexported fields
}

AnchorMap - contains map of anchors

func NewAnchorMap added in v1.6.0

func NewAnchorMap() *AnchorMap

NewAnchorMap -initialize anchorMap

func (*AnchorMap) CheckAnchorInResource added in v1.10.0

func (ac *AnchorMap) CheckAnchorInResource(pattern map[string]interface{}, resource interface{})

CheckAnchorInResource checks if condition anchor key has values

func (*AnchorMap) KeysAreMissing added in v1.10.0

func (ac *AnchorMap) KeysAreMissing() bool

KeysAreMissing - if any of the anchor key doesn't exists in the resource then it will return true if any of (key)=false then return KeysAreMissing() as true if all the keys exists in the pattern exists in resource then return KeysAreMissing() as false

type AnchorType added in v1.10.0

type AnchorType string
const (
	Condition       AnchorType = ""
	Global          AnchorType = "<"
	Negation        AnchorType = "X"
	AddIfNotPresent AnchorType = "+"
	Equality        AnchorType = "="
	Existence       AnchorType = "^"
)

type ValidationHandler added in v1.1.0

type ValidationHandler interface {
	Handle(
		handler resourceElementHandler,
		resourceMap map[string]interface{},
		originPattern interface{},
		ac *AnchorMap,
	) (string, error)
}

ValidationHandler for element processes

func CreateElementHandler added in v1.1.0

func CreateElementHandler(element string, pattern interface{}, path string) ValidationHandler

CreateElementHandler factory to process elements

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL