Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultParamErrorCode is the default http error code, 404 not found, // per-parameter. An error code can be setted via // the "else" keyword inside a route's path. DefaultParamErrorCode = 404 // DefaultParamType when parameter type is missing use this param type, defaults to string // and it should be remains unless earth split in two. DefaultParamType = ast.ParamTypeString )
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(fullpath string) ([]*ast.ParamStatement, error)
Parse takes a route "fullpath" and returns its param statements and an error on failure.
Types ¶
type ParamParser ¶
type ParamParser struct {
// contains filtered or unexported fields
}
ParamParser is the parser which is being used by the Parse function to parse path segments one by one and return their parsed parameter statements (param name, param type its functions and the inline route's functions).
func NewParamParser ¶
func NewParamParser(src string) *ParamParser
NewParamParser receives a "src" of a single parameter and returns a new ParamParser, ready to Parse.
func (ParamParser) Error ¶
func (p ParamParser) Error() error
func (*ParamParser) Parse ¶
func (p *ParamParser) Parse() (*ast.ParamStatement, error)
Parse parses the p.src and returns its param statement and an error on failure.
func (*ParamParser) Reset ¶
func (p *ParamParser) Reset(src string)
Reset resets this ParamParser, reset the errors and set the source to the input "src".
Click to show internal directories.
Click to hide internal directories.