Documentation ¶
Index ¶
- Variables
- func Deref(t reflect.Type) reflect.Type
- func FieldByIndexes(v reflect.Value, indexes []int) reflect.Value
- func FieldByIndexesReadOnly(v reflect.Value, indexes []int) reflect.Value
- func Indirect(v reflect.Value) reflect.Value
- func IndirectInit(v reflect.Value) reflect.Value
- func Init(v reflect.Value) reflect.Value
- func IsKind(t reflect.Type, k reflect.Kind) bool
- func IsNull(v reflect.Value) bool
- func IsNullable(t reflect.Type) bool
- func IsZero(v reflect.Value) bool
- func Set(src, v reflect.Value)
- func TypeOf(i interface{}) reflect.Type
- func ValueOf(i interface{}) reflect.Value
- func Zero(t reflect.Type) (v reflect.Value)
- type Fields
- type FormatFunc
- type MapFunc
- type Mapper
- func (m *Mapper) CodecByType(t reflect.Type) Structer
- func (m *Mapper) FieldByIndexes(v reflect.Value, idxs []int) reflect.Value
- func (m *Mapper) FieldByIndexesReadOnly(v reflect.Value, idxs []int) reflect.Value
- func (m *Mapper) FieldByName(v reflect.Value, name string) reflect.Value
- func (m *Mapper) LookUpFieldByName(v reflect.Value, name string) (reflect.Value, bool)
- func (m *Mapper) TraversalsByName(t reflect.Type, names []string) (idxs [][]int)
- func (m *Mapper) TraversalsByNameFunc(t reflect.Type, names []string, fn func(int, []int)) (idxs [][]int)
- type Struct
- type StructField
- func (sf *StructField) Children() []StructFielder
- func (sf *StructField) Index() []int
- func (sf *StructField) IsEmbedded() bool
- func (sf *StructField) IsNullable() bool
- func (sf *StructField) Name() string
- func (sf *StructField) Parent() StructFielder
- func (sf *StructField) ParentByTraversal(cb func(StructFielder) bool) StructFielder
- func (sf *StructField) Tag() StructTag
- func (sf *StructField) Type() reflect.Type
- type StructFielder
- type StructMapper
- type StructTag
- type Structer
- type Zeroer
Constants ¶
This section is empty.
Variables ¶
var DefaultMapper = NewMapperFunc("sqlike", nil)
DefaultMapper :
Functions ¶
func FieldByIndexes ¶
FieldByIndexes : get reflect.Value from struct by indexes. If the reflect.Value is nil, it will get initialized
func FieldByIndexesReadOnly ¶
FieldByIndexesReadOnly : get reflect.Value from struct by indexes without initialized
func IndirectInit ¶
IndirectInit : initialise reflect.Value till the deep level
func IsNullable ¶
IsNullable : determine whether is nullable data type
func IsZero ¶
IsZero : determine is zero value 1. string => empty string 2. bool => false 3. function => nil 4. map => nil (uninitialized map) 5. slice => nil (uninitialized slice)
Types ¶
type Fields ¶
type Fields []StructFielder
Fields :
type Mapper ¶
type Mapper struct {
// contains filtered or unexported fields
}
Mapper :
func (*Mapper) FieldByIndexes ¶
FieldByIndexes : get reflect.Value from struct by indexes. If the reflect.Value is nil, it will get initialized
func (*Mapper) FieldByIndexesReadOnly ¶
FieldByIndexesReadOnly : get reflect.Value from struct by indexes without initialized
func (*Mapper) FieldByName ¶
FieldByName : get reflect.Value from struct by field name
func (*Mapper) LookUpFieldByName ¶
LookUpFieldByName : lookup reflect.Value from struct by field name
func (*Mapper) TraversalsByName ¶
TraversalsByName :
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
Struct :
func (*Struct) GetByTraversal ¶
func (s *Struct) GetByTraversal(index []int) StructFielder
GetByTraversal :
func (*Struct) LookUpFieldByName ¶ added in v1.1.1
func (s *Struct) LookUpFieldByName(name string) (StructFielder, bool)
LookUpFieldByName :
type StructField ¶
type StructField struct {
// contains filtered or unexported fields
}
StructField :
func (*StructField) IsEmbedded ¶ added in v1.1.1
func (sf *StructField) IsEmbedded() bool
IsEmbedded :
func (*StructField) ParentByTraversal ¶
func (sf *StructField) ParentByTraversal(cb func(StructFielder) bool) StructFielder
ParentByTraversal :
type StructFielder ¶ added in v1.1.1
type StructFielder interface { // New name of struct field Name() string // reflect.Type of the field Type() reflect.Type // index position of the field Index() []int Tag() StructTag // if the field is struct, parent will not be nil // this will be the parent struct of current struct Parent() StructFielder ParentByTraversal(cb func(StructFielder) bool) StructFielder // if the field is struct, children will not be nil // this will be the fields of current struct Children() []StructFielder // determine the field is nullable IsNullable() bool // determine the field is embedded struct IsEmbedded() bool }
StructFielder :
type StructMapper ¶ added in v1.0.2
type StructMapper interface { CodecByType(t reflect.Type) Structer FieldByName(v reflect.Value, name string) reflect.Value FieldByIndexes(v reflect.Value, idxs []int) reflect.Value FieldByIndexesReadOnly(v reflect.Value, idxs []int) reflect.Value LookUpFieldByName(v reflect.Value, name string) (reflect.Value, bool) TraversalsByName(t reflect.Type, names []string) (idxs [][]int) TraversalsByNameFunc(t reflect.Type, names []string, fn func(int, []int)) (idxs [][]int) }
StructMapper :
type Structer ¶ added in v1.1.1
type Structer interface { Fields() []StructFielder Properties() []StructFielder LookUpFieldByName(name string) (StructFielder, bool) GetByTraversal(index []int) StructFielder }
Structer :