{"modulePath":"github.com/iris-framework/iris","version":"v6.0.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package router\n\n## Constants\n\n```go\nconst (\n\tParamNameSeperator = ':'\n\tFuncSeperator      = ' '\n\tFuncStart          = '('\n\tFuncEnd            = ')'\n\tFuncParamSeperator = ','\n\tFailSeparator      = '!'\n)\n```\n\n```go\nconst (\n\tPathSeparator = '/'\n\t// Out means that it doesn't being included in param.\n\tParamStartOut = '{'\n\tParamEndOut   = '}'\n)\n```\n\n```go\nconst DefaultFailStatusCode = 404\n```\n\n## Types\n\n```go\ntype CursorState int\n```\n\n```go\nconst (\n\t// no : is found yet\n\tCursorStateNone CursorState = iota\n\t// macro name and first expression guess parsed\n\t// and we' ready to walk forward\n\tCursorStateStarted\n\t// after space, waiting for a macro func begin or !+fail_status_code\n\tCursorStatePending\n\t// inside the macro func, after the opening parenthesis\n\tCursorStateRecording\n)\n```\nwe use that to set a value of each \"state\". because macro's function's arguments can accepts space and regex with any character\n\n```go\nfunc (cs *CursorState) Is(s CursorState) bool\n```\n\n```go\ntype MacroFuncTmpl struct {\n\t// range\n\tName string\n\t// 1,5\n\tParams []string\n}\n```\n\n```go\ntype MacroTmpl struct {\n\t// int\n\tName string\n\t// Macro will allow more than one funcs.\n\t// []*MacroFuncs{ {Name: range, Params: []string{1,5}}}\n\tFuncs []MacroFuncTmpl\n}\n```\n\n```go\ntype ParamTmpl struct {\n\t// id\n\tName string\n\t// int range(1,5)!fail # fail fails on int parse or on range, it will work reclusive\n\tExpression string\n\t// fail\n\tFailStatusCode int\n\n\tMacro MacroTmpl\n}\n```\n\n```go\nfunc ParseParam(source string) (*ParamTmpl, error)\n```\nParse i.e: id:int range(1,5) otherFunc(3) !404\n\nid        = param name | can front-end end here but the parser should add :any int       = marco | can end here\n\nrange     = marco's funcs(range) 1,5       = range's  func.params | can end here\n\n\t+\n\notherFunc = marco's funcs(otherFunc) 3         = otherFunc's func.params  | can end here\n\n404      = fail http custom error status code -\u003e handler , will fail rescuslive\n\n```go\ntype PathParamTmpl struct {\n\tSegmentIndex int\n\tParam        ParamTmpl\n}\n```\n\n```go\ntype PathTmpl struct {\n\tParams         []PathParamTmpl\n\tSegmentsLength int\n}\n```\n\n```go\nfunc ParsePath(source string) (*PathTmpl, error)\n```\n/users/{id:int range(1,5)}/profile parses only the contents inside {} but it gives back the position so it will be '1'\n\n","path":"github.com/iris-framework/iris/_future","name":"router","synopsis":"","isRedistributable":true}
