Documentation ¶
Overview ¶
The paths package provides capabilities for working with paths, which is a key part of Goweb. Advanced users should use the paths package if they are writing their own Handler implementations.
Index ¶
Constants ¶
const FileExtensionSeparator string = "."
const MatchAllPaths string = segmentCatchAll
const PathSeperator string = "/"
Variables ¶
This section is empty.
Functions ¶
func PathFromSegments ¶
func PathFromSegments(segments ...interface{}) string
PathFromSegments turns the arguments into a path string.
func PathPrefixForClass ¶
func PathPrefixForClass(controller interface{}) string
PathPrefixForClass gets the path prefix by reflecting on the name of the class of the specified object.
E.g.
LovelyPeopleController == "lovely-people"
Types ¶
type Path ¶
type Path struct { // RawPath is the original raw string of this path. RawPath string // contains filtered or unexported fields }
Path represents the path segment of a URL.
func (*Path) RealFilePath ¶
RealFilePath gets the real file path by assuming the current path is the public prefix, the urlPath is the actual request and the systemPath is the physical location where those files live.
type PathMatch ¶
PathMatch holds details about whether a path matches a PathPattern or not.
If it does match, the Parameters map will contain the values for any dynamic parameters discovered.
type PathPattern ¶
type PathPattern struct { // RawPath is the raw path. RawPath string // contains filtered or unexported fields }
PathPattern represents a path that can contain special matching segments.
Valid paths include:
/*** - Matches everything /*** /literal/ *** - match anything before and after literal /literal /{placeholder} /[optional placeholder] /* - matches like a placeholder but doesn't care what it is /something/*** - Matches the start plus anything after it
func NewPathPattern ¶
func NewPathPattern(path string) (*PathPattern, error)
func (*PathPattern) GetPathMatch ¶
func (p *PathPattern) GetPathMatch(path *Path) *PathMatch
GetPathMatch gets the PathMatch object describing the match or otherwise between this PathPattern and the specified Path.
func (*PathPattern) String ¶
func (p *PathPattern) String() string