mirror of
https://gitee.com/johng/gf
synced 2026-07-08 14:39:50 +08:00
feat(net/ghttp): add Request.GetMetaTag to retrieve specific meta tag value (#4185)
This commit is contained in:
@ -36,7 +36,7 @@ type Field struct {
|
||||
type FieldsInput struct {
|
||||
// Pointer should be type of struct/*struct.
|
||||
// TODO this attribute name is not suitable, which would make confuse.
|
||||
Pointer interface{}
|
||||
Pointer any
|
||||
|
||||
// RecursiveOption specifies the way retrieving the fields recursively if the attribute
|
||||
// is an embedded struct. It is RecursiveOptionNone in default.
|
||||
@ -47,7 +47,7 @@ type FieldsInput struct {
|
||||
type FieldMapInput struct {
|
||||
// Pointer should be type of struct/*struct.
|
||||
// TODO this attribute name is not suitable, which would make confuse.
|
||||
Pointer interface{}
|
||||
Pointer any
|
||||
|
||||
// PriorityTagArray specifies the priority tag array for retrieving from high to low.
|
||||
// If it's given `nil`, it returns map[name]Field, of which the `name` is attribute name.
|
||||
@ -123,6 +123,7 @@ func Fields(in FieldsInput) ([]Field, error) {
|
||||
}
|
||||
}
|
||||
continue
|
||||
default:
|
||||
}
|
||||
}
|
||||
continue
|
||||
@ -194,6 +195,7 @@ func FieldMap(in FieldMapInput) (map[string]Field, error) {
|
||||
mapField[k] = tempV
|
||||
}
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
mapField[field.Name()] = tempField
|
||||
@ -205,7 +207,19 @@ func FieldMap(in FieldMapInput) (map[string]Field, error) {
|
||||
|
||||
// StructType retrieves and returns the struct Type of specified struct/*struct.
|
||||
// The parameter `object` should be either type of struct/*struct/[]struct/[]*struct.
|
||||
func StructType(object interface{}) (*Type, error) {
|
||||
func StructType(object any) (*Type, error) {
|
||||
// if already reflect.Type
|
||||
if reflectType, ok := object.(reflect.Type); ok {
|
||||
for reflectType.Kind() == reflect.Ptr {
|
||||
reflectType = reflectType.Elem()
|
||||
}
|
||||
if reflectType.Kind() == reflect.Struct {
|
||||
return &Type{
|
||||
Type: reflectType,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
reflectValue reflect.Value
|
||||
reflectKind reflect.Kind
|
||||
|
||||
Reference in New Issue
Block a user