route

package
v0.0.0-...-1f40810 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegRouteFn = reload.BuildValFnWithAnyParams("regexRoute", RegRouteHook)

Functions

func Delete

func Delete(path string)

func Hook

func Hook(path string, fn func(Route) Route)

func PushRoute

func PushRoute(path string, route Route) error

PushRoute path can be const or regex string

eg: `(?P<controller>\w+)/(?P<method>\w+)`, route.Route{
		Path:   `(?P<controller>\w+)/(?P<method>\w+)`,
		Scene:  constraints.Home,
		Method: []string{"GET"},
		Type:   "reg",
	}

func RegRouteHook

func RegRouteHook(_ ...any) func() (map[string]Route, map[string]*regexp.Regexp)

func Replace

func Replace(path string, route Route)

func ResolveRoute

func ResolveRoute(h *wp.Handle)

Types

type Route

type Route struct {
	Path   string
	Scene  string
	Method []string
	Type   string
}

Route Type value equal const or reg

Jump to

Keyboard shortcuts

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