routing

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppNotFoundError = errors.WithLevel(errors.WithStatus(errors.Wrap(RouteError,
	"inter.App not found in RouteCollection"),
	net.StatusInternalServerError),
	log_level.CRITICAL)
View Source
var MethodNotAllowedError = errors.WithStatus(errors.Wrap(RouteError,
	"HTTP method not allowed"),
	net.StatusMethodNotAllowed)
View Source
var RouteNotFoundError = errors.WithStatus(errors.Wrap(RouteError,
	"no match was found for the specified URL"),
	net.StatusNotFound)

Functions

func DecorateRoutes

func DecorateRoutes(routes *RouteCollection)

func Fallback

func Fallback(controller inter.Controller) inter.RouteCollection

func NewRoute

func NewRoute(url string, method string, controller inter.Controller) inter.Route

func View

func View(uri string, view inter.View) inter.RouteCollection

Types

type Route

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

func (Route) Constraint

func (r Route) Constraint() map[string]string

func (Route) Controller

func (r Route) Controller() inter.Controller

func (Route) Domain

func (r Route) Domain() string

func (Route) Method

func (r Route) Method() string

func (Route) Middleware

func (r Route) Middleware() []inter.HttpMiddleware

func (Route) Name

func (r Route) Name() string

Get the name of the route instance

func (Route) Named

func (r Route) Named(patterns ...string) bool

Determine whether the route's name matches the given patterns

func (Route) RouteOptions

func (r Route) RouteOptions() inter.RouteOptions

func (*Route) SetConstraint

func (r *Route) SetConstraint(parameter string, regex string) inter.Route

func (*Route) SetDestination

func (r *Route) SetDestination(destination string) inter.Route

func (*Route) SetDomain

func (r *Route) SetDomain(domain string) inter.Route

func (*Route) SetExcludeMiddleware

func (r *Route) SetExcludeMiddleware(middlewares []inter.HttpMiddleware) inter.Route

func (*Route) SetMiddleware

func (r *Route) SetMiddleware(middlewaresToStore []inter.HttpMiddleware) inter.Route

func (*Route) SetName

func (r *Route) SetName(name string) inter.Route

Push or change the route name.

func (*Route) SetPrefix

func (r *Route) SetPrefix(prefix string) inter.Route

func (*Route) SetStatus

func (r *Route) SetStatus(status int) inter.Route

func (*Route) SetUri

func (r *Route) SetUri(uri string) inter.Route

func (Route) Uri

func (r Route) Uri() string

type RouteCollection

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

func Any

func Any(uri string, controller inter.Controller) *RouteCollection

Register a new route responding to all methods

func Delete

func Delete(uri string, controller inter.Controller) *RouteCollection

Register new DELETE routes

func Get

func Get(uri string, controller inter.Controller) *RouteCollection

Register new GET routes

func Group

func Group(routeCollections ...inter.RouteCollection) *RouteCollection

func Match

func Match(methods []string, uri string, controller inter.Controller) *RouteCollection

Register a new route with multiple methods

func NewRouteCollection

func NewRouteCollection(routeCollections ...inter.RouteCollection) *RouteCollection

func Options

func Options(uri string, controller inter.Controller) *RouteCollection

Register new OPTIONS routes

func Patch

func Patch(uri string, controller inter.Controller) *RouteCollection

Register new PATCH routes

func Post

func Post(uri string, controller inter.Controller) *RouteCollection

Register new POST routes

func Put

func Put(uri string, controller inter.Controller) *RouteCollection

Register new PUT routes

func Redirect

func Redirect(uri string, destination string, status int) *RouteCollection

Create a redirect from one URI to another.

func RedirectPermanent

func RedirectPermanent(uri string, destination string) *RouteCollection

Create a permanent redirect from one URI to another.

func RedirectTemporary

func RedirectTemporary(uri string, destination string) *RouteCollection

Create a temporary redirect from one URI to another.

func (RouteCollection) All

func (c RouteCollection) All() []inter.Route

func (*RouteCollection) Domain

func (c *RouteCollection) Domain(domain string) inter.RouteCollection

func (RouteCollection) Match

func (c RouteCollection) Match(request inter.Request) inter.Route

func (*RouteCollection) Merge

func (c *RouteCollection) Merge(routeCollection inter.RouteCollection) inter.RouteCollection

func (*RouteCollection) Middleware

func (c *RouteCollection) Middleware(middleware ...inter.HttpMiddleware) inter.RouteCollection

func (*RouteCollection) Name

func (*RouteCollection) Prefix

func (c *RouteCollection) Prefix(prefix string) inter.RouteCollection

func (*RouteCollection) Push

func (*RouteCollection) Where

func (c *RouteCollection) Where(parameter, regex string) inter.RouteCollection

Set a group of global where patterns on the routes.

func (*RouteCollection) WhereMulti

func (c *RouteCollection) WhereMulti(constraints map[string]string) inter.RouteCollection

func (*RouteCollection) WithoutMiddleware

func (c *RouteCollection) WithoutMiddleware(middleware ...inter.HttpMiddleware) inter.RouteCollection

type RouteOptions

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

func (RouteOptions) Prefixes

func (r RouteOptions) Prefixes() []string

func (RouteOptions) Status

func (r RouteOptions) Status() int

Jump to

Keyboard shortcuts

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