Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasAlias ¶
HasAlias returns any alias of the "pt" param type. If alias is empty or not found then it returns false as its second output argument.
func IsTrailing ¶
IsTrailing returns true if the "pt" param type is a marked as trailing, which should accept more than one path segment when in the end.
Types ¶
type AliasParamType ¶
AliasParamType if implemeneted nad its `Alias()` returns a non-empty string then the param type can be written with that string literal too.
type MasterParamType ¶
MasterParamType if implemented and its `Master()` returns true then empty type param will be translated to this param type. Also its functions will be available to the rest of the macro param type's funcs.
Only one Master is allowed.
type ParamFunc ¶
ParamFunc holds the name of a parameter's function and its arguments (values) A param func is declared with: {param:int range(1,5)}, the range is the param function name the 1 and 5 are the two param function arguments range(1,5)
type ParamStatement ¶
type ParamStatement struct { Src string // the original unparsed source, i.e: {id:int range(1,5) else 404} Name string // id Type ParamType // int Funcs []ParamFunc // range ErrorCode int // 404 }
ParamStatement is a struct which holds all the necessary information about a macro parameter. It holds its type (string, int, alphabetical, file, path), its source ({param:type}), its name ("param"), its attached functions by the user (min, max...) and the http error code if that parameter failed to be evaluated.
type ParamType ¶
type ParamType interface { // The name of the parameter type. // Indent should contain the characters for the parser. Indent() string }
ParamType holds the necessary information about a parameter type for the parser to lookup for.
func GetMasterParamType ¶
GetMasterParamType accepts a list of ParamType and returns its master. If no `Master` specified: and len(paramTypes) > 0 then it will return the first one, otherwise it returns nil.
type TrailingParamType ¶
TrailingParamType if implemented and its `Trailing()` returns true then it should be declared at the end of a route path and can accept any trailing path segment as one parameter.