1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00

new minor features

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-04-09 14:51:34 +03:00
parent f17a325df6
commit 4dfd4c53d3
14 changed files with 455 additions and 41 deletions

19
x/reflex/reflex.go Normal file
View File

@@ -0,0 +1,19 @@
package reflex
import "reflect"
// IndirectType returns the value of a pointer-type "typ".
// If "IndirectType" is a pointer, array, chan, map or slice it returns its Elem,
// otherwise returns the "typ" as it is.
func IndirectType(typ reflect.Type) reflect.Type {
switch typ.Kind() {
case reflect.Ptr, reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
return typ.Elem()
}
return typ
}
// IndirectValue returns the element type (e.g. if pointer of *User it will return the User type).
func IndirectValue(val reflect.Value) reflect.Value {
return reflect.Indirect(val)
}