Documentation ¶
Index ¶
- func FinalType(i interface{}) reflect.Type
- func FinalValue(i interface{}) reflect.Value
- func IsZero(v reflect.Value) bool
- func SliceArg(arg interface{}) (out []interface{})
- type Field
- type Pointer
- type Struct
- func (s *Struct) Each(fn func(field *Field))
- func (s *Struct) EachTag(tagKey string, fn func(field *Field, tagVal string))
- func (s *Struct) EachTagWithEmpty(tagKey string, fn func(field *Field, tagVal string))
- func (s *Struct) Field(name string) (*Field, error)
- func (s *Struct) Set(val reflect.Value) error
- func (s *Struct) Tag(field string) (*reflect.StructTag, error)
- func (s *Struct) Tags() (tags map[string]*reflect.StructTag, err error)
- func (s *Struct) ToMap(tag string) map[string]interface{}
- func (s *Struct) ToPtrMap(tag string) map[string]interface{}
- func (s *Struct) ToPtrSlice(tag string, fields []string) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FinalValue ¶
func SliceArg ¶
func SliceArg(arg interface{}) (out []interface{})
stolen from https://ahmetalpbalkan.com/blog/golang-take-slices-of-any-type-as-input-parameter/
Types ¶
type Struct ¶
func StructByType ¶
t must be a of Kind reflect.Struct
func StructByValue ¶
val must be the reflect.Value of a reference to a struct
func (*Struct) EachTag ¶
get every field and its tag for a given tag key, empty tags and tags with value "-" are ignored
func (*Struct) EachTagWithEmpty ¶
get every field and its tag for a given tag key, tags with value "-" are ignored
func (*Struct) ToMap ¶
ToMap converts a given struct to a map. If tag is not "", it follows the same semantics as json encoding, but for the given tag. Panics on errors
func (*Struct) ToPtrSlice ¶
Click to show internal directories.
Click to hide internal directories.