route

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2017 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeURL added in v0.10.0

func DecodeURL(encodedURL string) string

func EncodeURL added in v0.10.0

func EncodeURL(rawURL string) string

func ToKey

func ToKey(route Route) string

Types

type Route

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

func Combine

func Combine(route1, route2 Route) Route

combines two routes

func Intersect

func Intersect(baseRoute, subRoute Route) Route

func New

func New() Route

Create an empty route.

func NewFromFilePath

func NewFromFilePath(baseDirectory, itemPath string) Route

Creates a new route from the given base directory (e.g. "/home/user/repository") and item path (e.g. "/home/user/repository/documents/sample/files/image.jpg").

func NewFromItemDirectory

func NewFromItemDirectory(baseDirectory, itemDirectory string) Route

Creates a new route from the given base directory (e.g. "/home/user/repository") and item directory (e.g. "/home/user/repository/documents/sample").

func NewFromItemPath

func NewFromItemPath(baseDirectory, itemPath string) Route

Creates a new route from the given base directory (e.g. "/home/user/repository") and item path (e.g. "/home/user/repository/documents/sample/document.md") and strips the file name from the route.

func NewFromRequest

func NewFromRequest(requestPath string) Route

Create a new route from the given request path.

func (Route) Components

func (route Route) Components() []string

func (Route) Equals added in v0.10.0

func (route Route) Equals(otherRoute Route) bool

Equals compares the current route with the supplied route. Returns true if the routes are alike; otherwise false.

func (Route) FirstComponentName

func (route Route) FirstComponentName() string

func (Route) IsChildOf

func (child Route) IsChildOf(parent Route) bool

Check if the current route is a child of the supplied (parent) route.

func (Route) IsEmpty

func (route Route) IsEmpty() bool

func (Route) IsFileRoute

func (route Route) IsFileRoute() bool

func (Route) IsMatch

func (route Route) IsMatch(path string) bool

func (Route) IsParentOf

func (parent Route) IsParentOf(child Route) bool

Check if the the current route is direct parent for the supplied (child) route.

func (Route) LastComponentName

func (route Route) LastComponentName() string

func (Route) Level

func (route Route) Level() int

func (Route) OriginalValue

func (route Route) OriginalValue() string

func (Route) Parent

func (route Route) Parent() (parent Route, exists bool)

func (Route) Path

func (route Route) Path() string

func (Route) String

func (route Route) String() string

func (Route) SubRoute

func (route Route) SubRoute(level int) (Route, error)

func (Route) Value

func (route Route) Value() string

type Router

type Router interface {
	Route() *Route
}

Jump to

Keyboard shortcuts

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