routing

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 4 Imported by: 0

README

Pulse Routing (In Development)

Pulse Routing is a routing package for the Pulse Framework.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RouterHandler

func RouterHandler(router *Router) func(ctx *fasthttp.RequestCtx)

Types

type Context

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

func NewContext

func NewContext(ctx *fasthttp.RequestCtx) *Context

NewContext returns a new Context.

func (*Context) Abort

func (c *Context) Abort()

Abort aborts the chain.

func (*Context) Context

func (c *Context) Context() *fasthttp.RequestCtx

Context returns the fasthttp.RequestCtx

func (*Context) GetData

func (c *Context) GetData(key string) string

GetData returns the http header value for the given key.

func (*Context) Next

func (c *Context) Next() error

Next calls the next handler in the chain.

func (*Context) Param

func (c *Context) Param(key string) string

Param returns the param value for the given key.

func (*Context) Reset

func (c *Context) Reset()

Reset resets the Context.

func (*Context) SetData

func (c *Context) SetData(key string, value interface{})

SetData sets the http header value to the given key.

func (*Context) String

func (c *Context) String(value string) error

String sets the response body to the given string.

type Handler

type Handler func(ctx *Context) error

func CombineHandlers added in v1.0.1

func CombineHandlers(handlers ...Handler) Handler

type RouteParser added in v1.0.1

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

func Parse added in v1.0.1

func Parse(route string) RouteParser

Parse parses the route and returns a routeParser

type RouteStore

type RouteStore interface {
	Add(key string, data interface{}) int
	Get(path string) (data interface{})
}

type Router

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

func New

func New() *Router

func (*Router) Connect

func (r *Router) Connect(path string, handlers ...Handler)

Connect adds the route to the router with the CONNECT method

func (*Router) Delete

func (r *Router) Delete(path string, handlers ...Handler)

Delete adds the route to the router with the DELETE method

func (*Router) Get

func (r *Router) Get(path string, handlers ...Handler)

Get adds the route to the router with the GET method

func (*Router) Head

func (r *Router) Head(path string, handlers ...Handler)

Head adds the route to the router with the HEAD method

func (*Router) Options

func (r *Router) Options(path string, handlers ...Handler)

Options adds the route to the router with the OPTIONS method

func (*Router) Patch

func (r *Router) Patch(path string, handlers ...Handler)

Patch adds the route to the router with the PATCH method

func (*Router) Post

func (r *Router) Post(path string, handlers ...Handler)

Post adds the route to the router with the POST method

func (*Router) Put

func (r *Router) Put(path string, handlers ...Handler)

Put adds the route to the router with the PUT method

func (*Router) Trace

func (r *Router) Trace(path string, handlers ...Handler)

Trace adds the route to the router with the TRACE method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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