router

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Issuer         = "sola/router"
	CtxMeta        = "router.meta"
	CtxParamPrefix = "router.param."
)

Ctx

Variables

View Source
var (
	ErrNoMatch = errors.New("no match")
)

error(s)

Functions

func CtxParam

func CtxParam(key string) string

CtxParam Builder

func Param

func Param(c sola.Context, key string) string

Param in route

Types

type Meta

type Meta struct {
	Ctx     sola.Context
	Method  string
	Host    string
	Path    []string
	Default bool
}

Meta of Route

type Option added in v2.1.0

type Option struct {
	Pattern string
	// use sola handler if not match
	UseNotFound bool
}

Option of Router

type Router

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

Router Middleware Builder

func New

func New(o *Option) *Router

New Router Middleware

func (*Router) Bind

func (r *Router) Bind(pattern string, h sola.Handler, ms ...sola.Middleware)

Bind Handler

func (*Router) Routes

func (r *Router) Routes() sola.Middleware

Routes Middleware

func (*Router) Sub added in v2.1.0

func (r *Router) Sub(o *Option) *Router

Sub Router

func (*Router) Use added in v2.1.0

func (r *Router) Use(ms ...sola.Middleware)

Use Middleware

Jump to

Keyboard shortcuts

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