Documentation ¶
Index ¶
- func Fields(obj interface{}) ([]string, error)
- func FieldsDeep(obj interface{}) ([]string, error)
- func GetField(obj interface{}, name string) (interface{}, error)
- func GetFieldKind(obj interface{}, name string) (reflect.Kind, error)
- func GetFieldTag(obj interface{}, fieldName, tagKey string) (string, error)
- func GetFieldType(obj interface{}, name string) (string, error)
- func HasField(obj interface{}, name string) (bool, error)
- func Items(obj interface{}) (map[string]interface{}, error)
- func ItemsDeep(obj interface{}) (map[string]interface{}, error)
- func SetField(obj interface{}, name string, value interface{}) error
- func Tags(obj interface{}, key string) (map[string]string, error)
- func TagsDeep(obj interface{}, key string) (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fields ¶
Fields returns the struct fields names list. obj can whether be a structure or pointer to structure.
func FieldsDeep ¶
FieldsDeep returns "flattened" fields (fields from anonymous inner structs are treated as normal fields)
func GetField ¶
GetField returns the value of the provided obj field. obj can whether be a structure or pointer to structure.
func GetFieldKind ¶
GetFieldKind returns the kind of the provided obj field. obj can whether be a structure or pointer to structure.
func GetFieldTag ¶
GetFieldTag returns the provided obj field tag value. obj can whether be a structure or pointer to structure.
func GetFieldType ¶
GetFieldType returns the kind of the provided obj field. obj can whether be a structure or pointer to structure.
func HasField ¶
HasField checks if the provided field name is part of a struct. obj can whether be a structure or pointer to structure.
func Items ¶
Items returns the field - value struct pairs as a map. obj can whether be a structure or pointer to structure.
func ItemsDeep ¶
FieldsDeep returns "flattened" items (fields from anonymous inner structs are treated as normal fields)
func SetField ¶
SetField sets the provided obj field with provided value. obj param has to be a pointer to a struct, otherwise it will soundly fail. Provided value type should match with the struct field you're trying to set.
Types ¶
This section is empty.