Documentation ¶
Overview ¶
Package gstructs 提供结构体信息检索的功能
Index ¶
- func FieldMap(in FieldMapInput) (map[string]Field, error)
- func ParseTag(tagStr string) map[string]string
- func TagMapField(object interface{}, priority []string) (map[string]Field, error)
- func TagMapName(pointer interface{}, priority []string) (map[string]string, error)
- type Field
- func (f *Field) IsEmbedded() bool
- func (f *Field) IsEmpty() bool
- func (f *Field) IsExported() bool
- func (f *Field) IsNil(traceSource ...bool) bool
- func (f *Field) Kind() reflect.Kind
- func (f *Field) Name() string
- func (f *Field) OriginalKind() reflect.Kind
- func (f *Field) OriginalValue() reflect.Value
- func (f *Field) Tag(key string) string
- func (f *Field) TagAdditional() string
- func (f *Field) TagDefault() string
- func (f *Field) TagDescription() string
- func (f *Field) TagExample() string
- func (f *Field) TagIn() string
- func (f *Field) TagJsonName() string
- func (f *Field) TagLookup(key string) (value string, ok bool)
- func (f *Field) TagMap() map[string]string
- func (f *Field) TagParam() string
- func (f *Field) TagPriorityName() string
- func (f *Field) TagStr() string
- func (f *Field) TagSummary() string
- func (f *Field) TagValid() string
- func (f *Field) Type() Type
- type FieldMapInput
- type FieldsInput
- type RecursiveOption
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TagMapField ¶
TagMapField 获取结构体的标签字段映射
Types ¶
type Field ¶
type Field struct { Value reflect.Value // 字段的底层值 Field reflect.StructField // 字段的底层字段信息 TagName string // 检索到的标签名 TagValue string // 检索到的标签值 }
Field 包含结构体字段的信息
func (*Field) OriginalKind ¶
OriginalKind 返回字段值的原始Kind(解引用后)
func (*Field) OriginalValue ¶
OriginalValue 返回字段的原始值(解引用后)
func (*Field) TagPriorityName ¶
TagPriorityName 返回字段的优先级标签名称
type FieldMapInput ¶
type FieldMapInput struct { Pointer interface{} PriorityTagArray []string RecursiveOption RecursiveOption }
FieldMapInput 定义FieldMap函数的输入参数
type FieldsInput ¶
type FieldsInput struct { Pointer interface{} // 应该是结构体指针 RecursiveOption RecursiveOption // 递归选项 }
FieldsInput 定义Fields函数的输入参数
type RecursiveOption ¶
type RecursiveOption int
RecursiveOption 定义递归选项
const ( RecursiveOptionNone RecursiveOption = iota RecursiveOptionEmbedded RecursiveOptionEmbeddedNoTag )
Click to show internal directories.
Click to hide internal directories.