mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
Update to version 8.5.5 | Read HISTORY.md
Former-commit-id: dced7d472edabbab4f80c76051f13261928a8dea
This commit is contained in:
@@ -2,6 +2,7 @@ package ast
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -50,6 +51,40 @@ const (
|
||||
ParamTypePath
|
||||
)
|
||||
|
||||
// Not because for a single reason
|
||||
// a string may be a
|
||||
// ParamTypeString or a ParamTypeFile
|
||||
// or a ParamTypePath or ParamTypeAlphabetical.
|
||||
//
|
||||
// func ParamTypeFromStd(k reflect.Kind) ParamType {
|
||||
|
||||
// Kind returns the std kind of this param type.
|
||||
func (pt ParamType) Kind() reflect.Kind {
|
||||
switch pt {
|
||||
case ParamTypeAlphabetical:
|
||||
fallthrough
|
||||
case ParamTypeFile:
|
||||
fallthrough
|
||||
case ParamTypePath:
|
||||
fallthrough
|
||||
case ParamTypeString:
|
||||
return reflect.String
|
||||
case ParamTypeInt:
|
||||
return reflect.Int
|
||||
case ParamTypeLong:
|
||||
return reflect.Int64
|
||||
case ParamTypeBoolean:
|
||||
return reflect.Bool
|
||||
}
|
||||
return reflect.Invalid // 0
|
||||
}
|
||||
|
||||
// Assignable returns true if the "k" standard type
|
||||
// is assignabled to this ParamType.
|
||||
func (pt ParamType) Assignable(k reflect.Kind) bool {
|
||||
return pt.Kind() == k
|
||||
}
|
||||
|
||||
var paramTypes = map[string]ParamType{
|
||||
"string": ParamTypeString,
|
||||
"int": ParamTypeInt,
|
||||
|
||||
Reference in New Issue
Block a user