urlglob

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyURL            = errors.New("url should not be empty")
	ErrPatterntContinsData = errors.New("url pattern should not contain path, query or fragment")
	ErrSchemeMismatch      = errors.New("url scheme and mapping scheme is not equal")
	ErrTooManyWildcards    = errors.New("replcace pattern contains too many wildcards")
)

Functions

func PatchReplacePattern

func PatchReplacePattern(replacePattern *ReplacePattern, options ...replacePatternOption)

func UsePort

func UsePort(port string) replacePatternOption

func UseScheme

func UseScheme(scheme string) replacePatternOption

Types

type ReplacePattern

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

func NewReplacePattern

func NewReplacePattern(parsedPattern *url.URL, options ...replacePatternOption) (ReplacePattern, error)

func NewReplacePatternString

func NewReplacePatternString(rawURL string, options ...replacePatternOption) (ReplacePattern, error)

type URLGlob

type URLGlob struct {
	WildCardCount int
	Port          string
	Scheme        string
	// contains filtered or unexported fields
}

func NewURLGlob

func NewURLGlob(rawURL string) (*URLGlob, error)

func (*URLGlob) Match

func (glob *URLGlob) Match(parsedURL *url.URL) bool

func (*URLGlob) MatchString

func (glob *URLGlob) MatchString(rawURL string) (bool, error)

func (*URLGlob) ReplaceAll

func (glob *URLGlob) ReplaceAll(parsedURL *url.URL, repl ReplacePattern) (*url.URL, error)

func (*URLGlob) ReplaceAllString

func (glob *URLGlob) ReplaceAllString(rawURL string, repl ReplacePattern) (*url.URL, error)

Jump to

Keyboard shortcuts

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