gobuoy

package module
v0.0.0-...-dcd423a Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: MIT Imports: 3 Imported by: 0

README

license Build Status

Go Buoy

Go Buoy is a simple URL Path matcher. Its main purpose consists (but is not limited to) of matching routes for HTTP API.

Compared to RegEx use, it is:

  • faster
  • more secure
  • simpler to write
  • visually simpler to understand

See example

YEAH BUOYYYY

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMatcher

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

func NewKeyMatcher

func NewKeyMatcher(pattern string) *KeyMatcher

func (*KeyMatcher) GetMatches

func (m *KeyMatcher) GetMatches() map[string]string

func (*KeyMatcher) Match

func (m *KeyMatcher) Match(trial, match []byte) bool

type Matcher

type Matcher interface {
	Match([]byte, []byte) bool
	GetMatches() map[string]string
}

type Pattern

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

func NewPattern

func NewPattern(p string) *Pattern

func (*Pattern) IsComplete

func (p *Pattern) IsComplete() bool

func (*Pattern) IsMatching

func (p *Pattern) IsMatching() bool

func (*Pattern) Match

func (p *Pattern) Match(c byte) (res bool)

func (*Pattern) Next

func (p *Pattern) Next()

func (*Pattern) Reset

func (p *Pattern) Reset()

type Purl

type Purl struct {
	PathMatcher       Matcher
	QueryStringValues url.Values
}

func New

func New(path Matcher) *Purl

func NewCurlyMatcher

func NewCurlyMatcher() *Purl

func (*Purl) GetPathMatches

func (p *Purl) GetPathMatches() map[string]string

func (*Purl) GetQueryStringMatches

func (p *Purl) GetQueryStringMatches() url.Values

func (*Purl) Match

func (p *Purl) Match(url, pattern string) bool

func (*Purl) MatchPath

func (p *Purl) MatchPath(url, match string) bool

func (*Purl) MatchQueryString

func (p *Purl) MatchQueryString(u string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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