radix

package
v2.3.1-beta Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 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 (*Node) Insert

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

func (*Node) Match

func (n *Node) Match(ctx context.Context, path string) (context.Context, *Payload)

func (*Node) MustInsert

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

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(context.Context, string) (context.Context, *Payload)
}

func NewTree

func NewTree() Tree

Jump to

Keyboard shortcuts

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