router

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPath

func CleanPath(p string) string

Types

type Chain

type Chain struct {
	Middlewares []context.MiddlewareInterface
	Action      context.ActionInterface
	// contains filtered or unexported fields
}

type Default

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

func NewDefault

func NewDefault(m string, p string, a context.ActionInterface) *Default

func (*Default) Chain

func (d *Default) Chain() *Chain

func (*Default) Method

func (d *Default) Method() string

func (*Default) Middleware

func (d *Default) Middleware(middlewares ...context.MiddlewareInterface)

func (*Default) Path

func (d *Default) Path() string

type Group added in v0.0.8

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

func NewGroup added in v0.0.8

func NewGroup(path string, routers *Routers) *Group

func (*Group) CONNECT added in v0.0.8

func (g *Group) CONNECT(path string, ac context.ActionInterface) RouterInterface

func (*Group) DELETE added in v0.0.8

func (g *Group) DELETE(path string, ac context.ActionInterface) RouterInterface

func (*Group) DefRouter added in v0.0.8

func (g *Group) DefRouter(method string, path string, ac context.ActionInterface) RouterInterface

func (*Group) GET added in v0.0.8

func (*Group) HEAD added in v0.0.8

func (*Group) Middleware added in v0.0.8

func (g *Group) Middleware(middlewares ...context.MiddlewareInterface) *Group

func (*Group) Middlewares added in v0.0.8

func (g *Group) Middlewares() []context.MiddlewareInterface

func (*Group) OPTIONS added in v0.0.8

func (g *Group) OPTIONS(path string, ac context.ActionInterface) RouterInterface

func (*Group) PATCH added in v0.0.8

func (g *Group) PATCH(path string, ac context.ActionInterface) RouterInterface

func (*Group) POST added in v0.0.8

func (*Group) PUT added in v0.0.8

func (*Group) Path added in v0.0.8

func (g *Group) Path() string

func (*Group) TRACE added in v0.0.8

func (g *Group) TRACE(path string, ac context.ActionInterface) RouterInterface

type RouterInterface

type RouterInterface interface {
	Method() string
	Path() string
	Chain() *Chain
	Middleware(...context.MiddlewareInterface)
}

type Routers

type Routers struct {
	SaveMatchedRoutePath   bool
	RedirectTrailingSlash  bool
	RedirectFixedPath      bool
	HandleMethodNotAllowed bool
	HandleOPTIONS          bool
	GlobalOPTIONS          *Chain

	NotFound         *Chain
	MethodNotAllowed *Chain
	// contains filtered or unexported fields
}

func NewRouters

func NewRouters() *Routers

func (*Routers) Add

func (r *Routers) Add(router RouterInterface)

func (*Routers) Group added in v0.0.8

func (r *Routers) Group(path string) *Group

func (*Routers) Handle

func (r *Routers) Handle(method, path string, chain *Chain)

func (*Routers) HandleHTTP

func (r *Routers) HandleHTTP(c *context.Context)

func (*Routers) Lookup

func (r *Routers) Lookup(method, path string) (*Chain, context.Params, bool)

func (*Routers) Middlerware

func (r *Routers) Middlerware(middlewares ...context.MiddlewareInterface)

func (*Routers) ServeFiles

func (r *Routers) ServeFiles(path string, root http.FileSystem, chain *Chain)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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