Documentation
¶
Index ¶
- func CamelToSnake(s string) string
- func ConvertJSONArrayToSlice(arr []any, t reflect.Type) (reflect.Value, error)
- func IsAllLower(s string) bool
- func IsZero(v reflect.Value) bool
- func ParseSlice(s string, t reflect.Type) (reflect.Value, error)
- func SetDefaultValues(obj any) error
- func SetDefaultValuesRecursive(val reflect.Value) error
- func SetFieldValue(field reflect.Value, value string) error
- func SetJSONElementValue(val reflect.Value, item any, elemType reflect.Type, index int) error
- func SetSliceElementValue(val reflect.Value, part string, elemType reflect.Type) error
- func SnakeToCamel(s string) string
- func StringToMapHookFunc() mapstructure.DecodeHookFunc
- func StringToSliceHookFunc() mapstructure.DecodeHookFunc
- func ValidateStruct(obj any) error
- type CacheManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelToSnake ¶
CamelToSnake 驼峰命名转下划线命名 例如:CamelCase -> camel_case, AccessID -> access_id
func ConvertJSONArrayToSlice ¶
ConvertJSONArrayToSlice 将JSON数组转换为指定类型的切片
func ParseSlice ¶
ParseSlice 解析字符串为切片类型
func SetDefaultValuesRecursive ¶
SetDefaultValuesRecursive 递归设置默认值
func SetFieldValue ¶
SetFieldValue 设置字段值
func SetJSONElementValue ¶
SetJSONElementValue 设置JSON数组元素的值,改进错误处理
func SetSliceElementValue ¶
SetSliceElementValue 设置切片元素的值,带类型安全检查
func SnakeToCamel ¶
SnakeToCamel 下划线命名转驼峰命名 例如:snake_case -> snakeCase, access_id -> accessId
func StringToMapHookFunc ¶
func StringToMapHookFunc() mapstructure.DecodeHookFunc
StringToMapHookFunc 创建mapstructure的字符串到map转换hook
func StringToSliceHookFunc ¶
func StringToSliceHookFunc() mapstructure.DecodeHookFunc
StringToSliceHookFunc 创建mapstructure的字符串到切片转换hook
Types ¶
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager 缓存管理器
func (*CacheManager) GetCamelToSnake ¶
func (cm *CacheManager) GetCamelToSnake(key string) (string, bool)
GetCamelToSnake 获取camelCase到snake_case的缓存
func (*CacheManager) GetSnakeToCamel ¶
func (cm *CacheManager) GetSnakeToCamel(key string) (string, bool)
GetSnakeToCamel 获取snake_case到camelCase的缓存
func (*CacheManager) SetCamelToSnake ¶
func (cm *CacheManager) SetCamelToSnake(key, value string)
SetCamelToSnake 设置camelCase到snake_case的缓存
func (*CacheManager) SetSnakeToCamel ¶
func (cm *CacheManager) SetSnakeToCamel(key, value string)
SetSnakeToCamel 设置snake_case到camelCase的缓存
Click to show internal directories.
Click to hide internal directories.