Documentation ¶
Index ¶
Constants ¶
View Source
const ( ParamNameSeperator = ':' FuncSeperator = ' ' FuncStart = '(' FuncEnd = ')' FuncParamSeperator = ',' FailSeparator = '!' )
View Source
const ( PathSeparator = '/' // Out means that it doesn't being included in param. ParamStartOut = '{' ParamEndOut = '}' )
View Source
const DefaultFailStatusCode = 404
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CursorState ¶
type CursorState int
const ( // no : is found yet CursorStateNone CursorState = iota // macro name and first expression guess parsed // and we' ready to walk forward CursorStateStarted // after space, waiting for a macro func begin or !+fail_status_code CursorStatePending // inside the macro func, after the opening parenthesis CursorStateRecording )
we use that to set a value of each "state". because macro's function's arguments can accepts space and regex with any character
func (*CursorState) Is ¶
func (cs *CursorState) Is(s CursorState) bool
type MacroFuncTmpl ¶
type MacroTmpl ¶
type MacroTmpl struct { // int Name string // Macro will allow more than one funcs. // []*MacroFuncs{ {Name: range, Params: []string{1,5}}} Funcs []MacroFuncTmpl }
type ParamTmpl ¶
type ParamTmpl struct { // id Name string // int range(1,5)!fail # fail fails on int parse or on range, it will work reclusive Expression string // fail FailStatusCode int Macro MacroTmpl }
func ParseParam ¶
Parse i.e: id:int range(1,5) otherFunc(3) !404
id = param name | can front-end end here but the parser should add :any int = marco | can end here
range = marco's funcs(range) 1,5 = range's func.params | can end here
+
otherFunc = marco's funcs(otherFunc) 3 = otherFunc's func.params | can end here
404 = fail http custom error status code -> handler , will fail rescuslive
type PathParamTmpl ¶
Click to show internal directories.
Click to hide internal directories.