Documentation ¶
Index ¶
- func ContainTag(item interface{}, tag string) bool
- func Copy(src interface{}) interface{}
- func DeepCopySlice[T any](data []T, ns ...int) []T
- func GetAllFields(item interface{}) ([]*reflect.StructField, error)
- func GetFieldSpecificValue[T any](item interface{}, fieldName string) (T, reflect.Kind, error)
- func GetFieldTag(field *reflect.StructField, tagType string) (string, bool)
- func GetFieldValue(item interface{}, fieldName string) (reflect.Value, error)
- func GetFieldValueToFloat(item interface{}, fieldName string) (float64, error)
- func GetFieldValueToInt(item interface{}, fieldName string) (int64, error)
- func SetField(item interface{}, fieldName string, value interface{}) error
- func ToAnyMap(item interface{}, skip ...string) map[string]interface{}
- func ToAnyMapDeep(item interface{}, skip ...string) map[string]interface{}
- func ToAnyMapWithJson(item interface{}, skip ...string) map[string]interface{}
- func ToAnyMapWithJsonDeep(item interface{}, skip ...string) map[string]interface{}
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainTag ¶ added in v1.0.11
ContainTag 判断结构体是否含有特定的json内容
func Copy ¶
func Copy(src interface{}) interface{}
Copy creates a deep copy of whatever is passed to it and returns the copy in an interface{}. The returned value will need to be asserted to the correct type. note: can't copy unexported field: https://stackoverflow.com/questions/38369350/how-to-clone-a-structure-with-unexported-field
func DeepCopySlice ¶ added in v1.0.23
DeepCopySlice 深度复制切片
func GetAllFields ¶ added in v1.0.37
func GetAllFields(item interface{}) ([]*reflect.StructField, error)
GetAllFields 取出全部Field字段
func GetFieldSpecificValue ¶ added in v1.0.37
GetFieldSpecificValue 取出Struct的Field值, 传入精确的类型
func GetFieldTag ¶ added in v1.0.37
func GetFieldTag(field *reflect.StructField, tagType string) (string, bool)
GetFieldTag 获取StructField对应的tag值
func GetFieldValueToFloat ¶ added in v1.0.37
func GetFieldValueToInt ¶ added in v1.0.37
func ToAnyMapDeep ¶ added in v1.0.20
ToAnyMapDeep 把任意数据递归转换为字符串形式的任意map
func ToAnyMapWithJson ¶ added in v1.0.17
ToAnyMapWithJson 把任意数据转换为json字符串形式的任意map
func ToAnyMapWithJsonDeep ¶ added in v1.0.20
ToAnyMapWithJsonDeep 把任意数据递归转换为json字符串形式的任意map
Types ¶
Click to show internal directories.
Click to hide internal directories.