routertree

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPathNodeNotFound = errors.New("path node not found")
	ErrNotFound         = errors.New("operation not found")
)

Functions

This section is empty.

Types

type MatchOperation

type MatchOperation struct {
	Method    string
	Path      string
	Operation string
	Verb      string
	Vars      []PathFieldVar
	Extras    map[string]any
}

type PathFieldVar

type PathFieldVar struct {
	Fields []string
	Value  string
}

type RouteOperation

type RouteOperation struct {
	Method    string         `json:"method,omitempty"`
	Path      string         `json:"path,omitempty"`
	Operation string         `json:"operation,omitempty"`
	Verb      string         `json:"verb,omitempty"`
	Vars      []string       `json:"vars,omitempty"`
	Extras    map[string]any `json:"extras"`
}

type RouteTree

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

func NewRouteTree

func NewRouteTree() *RouteTree

func (*RouteTree) Add

func (r *RouteTree) Add(method string, path string, operation string, extras map[string]any) error

func (*RouteTree) List

func (r *RouteTree) List() []RouteOperation

func (*RouteTree) Match

func (r *RouteTree) Match(method, url string) (*MatchOperation, error)

Jump to

Keyboard shortcuts

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