resourcepath

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Pakage resourcepath provides functions to work with AEP resource paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Elements

func Elements(path string) iter.Seq[Element]

Elements returns an iterator over the elements of the resource path.

func Matches

func Matches(pattern, path string) bool

Matches returns true if the path matches the pattern.

Types

type Element

type Element string

EBNF

element  = variable | literal ;
variable = "{" literal "}" ;

func (Element) GetLiteral

func (e Element) GetLiteral() Literal

GetLiteral returns the literal value of the element.

func (Element) IsVariable

func (e Element) IsVariable() bool

IsVariable returns true if the element is a variable.

func (Element) IsWildcard

func (e Element) IsWildcard() bool

IsWildcard returns true if the element is a wildcard.

type Literal

type Literal string

type ResourcePath

type ResourcePath struct {
	// contains filtered or unexported fields
}

ResourcePath represents an AEP resource path.

func NewResourcePath

func NewResourcePath(elements map[string]string) *ResourcePath

NewResourcePath creates a new ResourcePath.

func ParseString

func ParseString(path, pattern string) (*ResourcePath, error)

ParseString parses a path and a pattern and returns a ResourcePath.

func (ResourcePath) Get

func (p ResourcePath) Get(element string) string

Get returns the value of the element. If the element is not found, an empty string is returned.

Jump to

Keyboard shortcuts

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