1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-26 14:27:04 +00:00

add a new x/sqlx sub-package and example

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-03-08 00:33:08 +02:00
parent 28af63fd84
commit 4ecc9e3831
8 changed files with 595 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ package reflex
import "reflect"
// LookupFields returns a slice of all fields containg a struct field
// LookupFields returns a slice of all fields containing a struct field
// of the given "fieldTag" of the "typ" struct. The fields returned
// are flatted and reclusive over fields with value of struct.
// Panics if "typ" is not a type of Struct.
@@ -54,3 +54,14 @@ func lookupFields(typ reflect.Type, fieldTag string, parentIndex []int) []reflec
return fields
}
// LookupUnderlineValueType returns the underline type of "v".
func LookupUnderlineValueType(v reflect.Value) (reflect.Value, reflect.Type) {
typ := v.Type()
for typ.Kind() == reflect.Ptr {
typ = typ.Elem()
v = reflect.New(typ).Elem()
}
return v, typ
}