radix

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 3 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 (*Node) Insert

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

func (*Node) Match

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

func (*Node) MustInsert

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

type Params added in v0.5.0

type Params map[string]string

type Payload

type Payload struct {
	MethodsMap types.MethodsMap
	Allow      string
}

type Segment

type Segment struct {
	IsDynamic bool
	Payload   string
}

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

type Tree

type Tree interface {
	Insert(Template, Payload) error
	MustInsert(Template, Payload)
	Match(Params, string) *Payload
}

func NewTree

func NewTree() Tree

Jump to

Keyboard shortcuts

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