Documentation ¶
Overview ¶
* @desc: 反射相关工具方法 * @Author: lfzxs@qq.com * @Date: 2022/5/10 9:28
Index ¶
- func EncryptPassword(password, salt string) string
- func FieldInfoCallBack(item reflect.StructField, value any)
- func FileIsExisted(filename string) bool
- func FindParentBySonPid(list g.List, id int, params ...interface{}) g.List
- func FindSonByParentId(list g.List, parentId interface{}, parentIndex, idIndex string) g.List
- func FindTopParent(list g.List, id int64, params ...interface{}) g.Map
- func ForEachStruct(model any, callback ForEachStructCallBakck)
- func GetCityByIp(ip string) string
- func GetClientIp(ctx context.Context) string
- func GetDomain(ctx context.Context) string
- func GetExt(fileName string) string
- func GetLocalIP() (ip string, err error)
- func GetSliceByKey(args []interface{}, key int, val interface{}) interface{}
- func GetStructItemValue(model any, name string) (any, bool)
- func GetTopPidList(list g.List, parentIndex, idIndex string) *garray.Array
- func GetType(p string) (result string, err error)
- func GetUserAgent(ctx context.Context) string
- func InterfaceToString(value interface{}) string
- func IsNotExistMkDir(src string) error
- func MkDir(src string) error
- func ParentSonSort(list g.List, params ...interface{}) g.List
- func ParseFilePath(pathStr string) (fileName string, fileType string)
- func PushSonToParent(list g.List, params ...interface{}) g.List
- func SnowflakeId() int64
- func SnowflakeIdStr() string
- func WriteToFile(fileName string, content string) error
- type ForEachStructCallBakck
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldInfoCallBack ¶
func FieldInfoCallBack(item reflect.StructField, value any)
func FindParentBySonPid ¶
FindParentBySonPid 有层级关系的数组,通过子级fid查找所有父级数组
func FindSonByParentId ¶
FindSonByParentId 有层级关系的切片,通过父级id查找所有子级id数组 parentId 父级id parentIndex 父级索引名称 idIndex id索引名称
func FindTopParent ¶
FindTopParent *
- 根据id查询最顶层父级信息
- @param list 有层级关系的数组
- @param id 查找的id
- @param string fpid 父级id键名
- @param string fid 当前id键名
- @return g.Map
func ForEachStruct ¶
func ForEachStruct(model any, callback ForEachStructCallBakck)
func GetSliceByKey ¶
func GetSliceByKey(args []interface{}, key int, val interface{}) interface{}
GetSliceByKey 获取切片里的值 若为nil 可设置默认值val
func GetTopPidList ¶
GetTopPidList 获取最顶层 parent Id
func ParentSonSort ¶
ParentSonSort 有层级关系的数组,父级-》子级 排序
func ParseFilePath ¶
解析路径获取文件名称及后缀
func PushSonToParent ¶
PushSonToParent 有层级关系的数组 ,将子级压入到父级(树形结构)
Types ¶
type ForEachStructCallBakck ¶
type ForEachStructCallBakck func(item reflect.StructField, value any)
* * item: 字段项 * value: 项值对象 *
Click to show internal directories.
Click to hide internal directories.