radix

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyPath = errors.New("template cannot be empty")
View Source
var ErrNotImplemented = errors.New(
	"different dynamic segment names are not allowed for common path prefix",
)

Functions

This section is empty.

Types

type Node

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

func New added in v0.16.0

func New() *Node

func (*Node) Insert

func (n *Node) Insert(template Template, payload Payload) error

func (*Node) Match

func (n *Node) Match(path string, params Params) *Payload

func (*Node) MustInsert

func (n *Node) MustInsert(template Template, payload Payload)

type Params

type Params = *keyvalue.Storage

type Payload

type Payload struct {
	MethodsMap types.MethodsMap
	Allow      string
}

type Segment

type Segment struct {
	Payload    string
	IsWildcard bool
}

type Template

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

Template is a parsed template. It simply contains static parts, and marker names index of each corresponds to index of static part (first static part, then marker)

func MustParse

func MustParse(tmpl string) Template

func Parse

func Parse(tmpl string) (Template, error)

func (Template) IsStatic

func (t Template) IsStatic() bool

IsStatic tells whether the template contains any of wildcards

type Tree

type Tree = *Node

Jump to

Keyboard shortcuts

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