mirror of
https://github.com/kataras/iris.git
synced 2025-01-26 03:56:34 +01:00
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
|
||
|
}
|