route

package
v0.0.0-...-d0dd730 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(r *Route)

Add adds a route to the list

func AddRoute

func AddRoute(Method string, Path string, HandlerFunc interface{}, RequiredGroups []string, Name string, Prefix string)

AddRoute adds a route to the list

Types

type Route

type Route struct {
	Prefix string
	Method string
	Path   string
	Name   string

	//HandlerFunc is a little bit hacky, because we need the route package also in the implementation
	//therefore we have to use the func as interface, because else, we would get circle references
	HandlerFunc interface{}

	//RequiredGroups are the groups the user must be in, in order to access the route
	//the groups are used as OR, means, the user must be in at least one group
	RequiredGroups []string
}

Route is a route in the API

func GetRouteForName

func GetRouteForName(n string) *Route

GetRouteForName returns the route for a name or nil

func GetRoutesForPrefix

func GetRoutesForPrefix(p string) []*Route

GetRoutesForPrefix returns all routes for a prefix

type Routes

type Routes map[string]*Route

Routes dictionary of name->route

var AppRoutes Routes

AppRoutes holds all routes of the app

Jump to

Keyboard shortcuts

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