routes

package
v0.0.0-...-5a1941a Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2016 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package routes is used for parsing route comments and route field tags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prefixes

type Prefixes []Route

Prefixes stores information about route prefixes of a controller.

func NewPrefixes

func NewPrefixes() Prefixes

NewPrefixes allocates and returns a new Prefixes object.

func ParseTag

func ParseTag(t string) (ps Prefixes)

ParseTag gets a tag string and extracts route prefixes out of it. If that's not possible, {}, false is returned.

func (Prefixes) ParseRoutes

func (ps Prefixes) ParseRoutes(controller string, f *r.Func) (rs []Route)

ParseRoutes gets a controller name and an action function and returns all the routes that are presented in its comments concatenated with the specified prefixes. If method is specified however pattern isn't, controller/action combination is used as a pattern.

type Route

type Route struct {
	Pattern, Method, HandlerName, Label string
}

Route represents a single route, i.e. pattern and an associated method.

Jump to

Keyboard shortcuts

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