Documentation
¶
Index ¶
- func DecodeURL(encodedURL string) string
- func EncodeURL(rawURL string) string
- func ToKey(route Route) string
- type Route
- func Combine(route1, route2 Route) Route
- func Intersect(baseRoute, subRoute Route) Route
- func New() Route
- func NewFromFilePath(baseDirectory, itemPath string) Route
- func NewFromItemDirectory(baseDirectory, itemDirectory string) Route
- func NewFromItemPath(baseDirectory, itemPath string) Route
- func NewFromRequest(requestPath string) Route
- func (route Route) Components() []string
- func (route Route) Equals(otherRoute Route) bool
- func (route Route) FirstComponentName() string
- func (child Route) IsChildOf(parent Route) bool
- func (route Route) IsEmpty() bool
- func (route Route) IsFileRoute() bool
- func (route Route) IsMatch(path string) bool
- func (parent Route) IsParentOf(child Route) bool
- func (route Route) LastComponentName() string
- func (route Route) Level() int
- func (route Route) OriginalValue() string
- func (route Route) Parent() (parent Route, exists bool)
- func (route Route) Path() string
- func (route Route) String() string
- func (route Route) SubRoute(level int) (Route, error)
- func (route Route) Value() string
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func NewFromFilePath ¶
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 ¶
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 ¶
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 ¶
Create a new route from the given request path.
func (Route) Components ¶
func (Route) Equals ¶ added in v0.10.0
Equals compares the current route with the supplied route. Returns true if the routes are alike; otherwise false.
func (Route) FirstComponentName ¶
func (Route) IsFileRoute ¶
func (Route) IsParentOf ¶
Check if the the current route is direct parent for the supplied (child) route.