mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
comment update;standardize const naming for package gtcp/gudp
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
|
||||
// Package structs provides functions for struct conversion.
|
||||
// Package structs provides functions for struct information retrieving and struct conversion.
|
||||
//
|
||||
// Inspired and improved from: https://github.com/fatih/structs
|
||||
package structs
|
||||
|
||||
@ -16,7 +16,7 @@ func (f *Field) Tag(key string) string {
|
||||
|
||||
// TagLookup returns the value associated with key in the tag string.
|
||||
// If the key is present in the tag the value (which may be empty)
|
||||
// is returned. Otherwise the returned value will be the empty string.
|
||||
// is returned. Otherwise, the returned value will be the empty string.
|
||||
// The ok return value reports whether the value was explicitly set in
|
||||
// the tag string. If the tag does not have the conventional format,
|
||||
// the value returned by Lookup is unspecified.
|
||||
|
||||
@ -53,7 +53,7 @@ func ParseTag(tag string) map[string]string {
|
||||
if i >= len(tag) {
|
||||
break
|
||||
}
|
||||
quotedValue := string(tag[:i+1])
|
||||
quotedValue := tag[:i+1]
|
||||
tag = tag[i+1:]
|
||||
value, err := strconv.Unquote(quotedValue)
|
||||
if err != nil {
|
||||
@ -137,6 +137,7 @@ func getFieldValues(value interface{}) ([]*Field, error) {
|
||||
goto exitLoop
|
||||
}
|
||||
}
|
||||
|
||||
exitLoop:
|
||||
for reflectKind == reflect.Ptr {
|
||||
reflectValue = reflectValue.Elem()
|
||||
|
||||
@ -37,13 +37,16 @@ func StructType(object interface{}) (*Type, error) {
|
||||
reflectValue = reflectValue.Elem()
|
||||
reflectKind = reflectValue.Kind()
|
||||
}
|
||||
|
||||
case reflect.Array, reflect.Slice:
|
||||
reflectValue = reflect.New(reflectValue.Type().Elem()).Elem()
|
||||
reflectKind = reflectValue.Kind()
|
||||
|
||||
default:
|
||||
goto exitLoop
|
||||
}
|
||||
}
|
||||
|
||||
exitLoop:
|
||||
for reflectKind == reflect.Ptr {
|
||||
reflectValue = reflectValue.Elem()
|
||||
@ -63,7 +66,7 @@ exitLoop:
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Signature returns an unique string as this type.
|
||||
// Signature returns a unique string as this type.
|
||||
func (t Type) Signature() string {
|
||||
return t.PkgPath() + "/" + t.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user