Documentation ¶
Index ¶
- func GetElementType(rt reflect.Type) reflect.Type
- func Has[T comparable](s []T, x T) bool
- func IsAnonymousStruct(fieldType reflect.Type) bool
- func Pluralize(word string) string
- func QueryFieldTag(tag reflect.StructTag, label string, undefined string) string
- func QueryJsonName(tag reflect.StructTag, undefined string) string
- func ReflectFuncName(handler any) string
- func ReflectObjectType(obj any) reflect.Type
- func StringsToFloats(strs []string) []float64
- func StringsToInts(strs []string) []int
- func Ternary[T any](cond bool, ifTrue, ifFalse T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Has ¶
func Has[T comparable](s []T, x T) bool
Has 查找序列s内是否存在元素x
@param s []T 查找序列 @param x T 特定元素 @return bool true if s contains x, false otherwise
func IsAnonymousStruct ¶
IsAnonymousStruct 是否是匿名(未声明)的结构体
func QueryFieldTag ¶
QueryFieldTag 查找struct字段的Tag
@param tag reflect.StructTag 字段的Tag @param label string 要查找的标签 @param undefined string 当查找的标签不存在时返回的默认值 @return string 查找到的标签值, 不存在则返回提供的默认值
func QueryJsonName ¶
QueryJsonName 查询字段定义的json名称
func ReflectObjectType ¶
ReflectObjectType 获取任意对象的类型,若为指针,则反射具体的类型
func StringsToFloats ¶
StringsToFloats 将字符串数组转换成float64数组, 简单实现
@param strs []string 输入字符串数组 @return []float64 输出float64数组
func StringsToInts ¶
StringsToInts 将字符串数组转换成int数组, 简单实现
@param strs []string 输入字符串数组 @return []int 输出int数组
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.