Documentation
¶
Overview ¶
Package jsonflags 解析并缓存结构体字段上的 JSON 风格标签信息。
这个包为请求解码、参数映射和校验器构建提供字段名、别名、大小写和包装值等元数据。
copy from https://github.com/go-json-experiment/json/blob/master/fields.go
Package jsonflags GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
Index ¶
- Variables
- func Implements(t reflect.Type, ifaceType reflect.Type) bool
- func UnmarshalFromString(typ reflect.Type) bool
- func Unwrap(v any) any
- func ValueWithStructField(v any, sf *StructField) any
- type Casing
- type FieldOptions
- type StructField
- type StructFields
- func (s *StructFields) InlinedFallback() (*StructField, bool)
- func (s *StructFields) Len() int
- func (s *StructFields) LocatedStructField(location string) iter.Seq[*StructField]
- func (s *StructFields) Lookup(name string) (*StructField, bool)
- func (s *StructFields) LookupLocated(location string, name string) (*StructField, bool)
- func (s *StructFields) StructField() iter.Seq[*StructField]
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
View Source
var Structs = &cache{}
Functions ¶
func UnmarshalFromString ¶
func ValueWithStructField ¶
func ValueWithStructField(v any, sf *StructField) any
Types ¶
type FieldOptions ¶
type FieldOptions struct {
Name string
QuotedName string
HasName bool
Casing Casing
Inline bool
Unknown bool
Omitzero bool
Omitempty bool
String bool
Format string
StringItem bool
}
func ParseFieldOptions ¶
func ParseFieldOptions(sf reflect.StructField) (FieldOptions, bool, error)
func (*FieldOptions) RuntimeDoc ¶
func (v *FieldOptions) RuntimeDoc(names ...string) ([]string, bool)
type StructField ¶
type StructField struct {
FieldOptions
FieldName string
Tag reflect.StructTag
Type reflect.Type
// contains filtered or unexported fields
}
func (*StructField) GetOrNewAt ¶
func (f *StructField) GetOrNewAt(v reflect.Value) reflect.Value
func (*StructField) RuntimeDoc ¶
func (v *StructField) RuntimeDoc(names ...string) ([]string, bool)
type StructFields ¶
type StructFields struct {
// contains filtered or unexported fields
}
func (*StructFields) InlinedFallback ¶
func (s *StructFields) InlinedFallback() (*StructField, bool)
func (*StructFields) Len ¶
func (s *StructFields) Len() int
func (*StructFields) LocatedStructField ¶
func (s *StructFields) LocatedStructField(location string) iter.Seq[*StructField]
func (*StructFields) Lookup ¶
func (s *StructFields) Lookup(name string) (*StructField, bool)
func (*StructFields) LookupLocated ¶
func (s *StructFields) LookupLocated(location string, name string) (*StructField, bool)
func (*StructFields) StructField ¶
func (s *StructFields) StructField() iter.Seq[*StructField]
type Wrapper ¶
type Wrapper interface {
Unwrap() any
StructField() *StructField
}
Click to show internal directories.
Click to hide internal directories.