mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 19:21:03 +01:00
a95a02a16a
Former-commit-id: 826d7c370481b78afd9ba92f4ae8bef1fb85a567
41 lines
730 B
Go
41 lines
730 B
Go
package ast
|
|
|
|
type ParamType uint8
|
|
|
|
const (
|
|
ParamTypeUnExpected ParamType = iota
|
|
// /42
|
|
ParamTypeInt
|
|
// /myparam1
|
|
ParamTypeString
|
|
// /myparam
|
|
ParamTypeAlphabetical
|
|
// /myparam1/myparam2
|
|
ParamPath
|
|
)
|
|
|
|
var paramTypes = map[string]ParamType{
|
|
"int": ParamTypeInt,
|
|
"string": ParamTypeString,
|
|
"alphabetical": ParamTypeAlphabetical,
|
|
"path": ParamPath,
|
|
// could be named also:
|
|
// "tail":
|
|
// "wild"
|
|
// "wildcard"
|
|
}
|
|
|
|
func LookupParamType(ident string) ParamType {
|
|
if typ, ok := paramTypes[ident]; ok {
|
|
return typ
|
|
}
|
|
return ParamTypeUnExpected
|
|
}
|
|
|
|
type ParamStatement struct {
|
|
Name string // id
|
|
Type ParamType // int
|
|
Funcs []ParamFunc // range
|
|
ErrorCode int // 404
|
|
}
|