router

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const RoutingParamsKey = "__flamel_routing_params__"

Variables

View Source
var ErrRouteNotFound = errors.New("can't find route")

Functions

This section is empty.

Types

type Param

type Param struct {
	Key   string
	Value string
}

type Params

type Params []Param

type Route

type Route struct {
	Name    string
	Handler func(ctx context.Context) (interface{}, context.Context)
	// contains filtered or unexported fields
}

Route class

func NewRoute

func NewRoute(url string, handler func(ctx context.Context) (interface{}, context.Context)) Route

type Router

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

func NewRouter

func NewRouter() Router

func (*Router) RouteForPath

func (router *Router) RouteForPath(ctx context.Context, path string) (context.Context, error, interface{})

Given the path it returns the assigned route from the radix tree

func (*Router) SetRoute

func (router *Router) SetRoute(path string, handler func(ctx context.Context) (interface{}, context.Context))

Creates the path - route relationship. handler is invoked once the route is found

Jump to

Keyboard shortcuts

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