Documentation ¶
Overview ¶
Package helper 助手工具
Index ¶
- Constants
- func CamelToUnder(str string) string
- func GetFileBaseName(fileName string) string
- func GetFileExt(fileName string) string
- func GetRandomString(length int) string
- func Img() *img
- func InSlice(item string, items []string) bool
- func InterfaceToInt(val interface{}) int
- func MinusStrList(strA, strB []string) []string
- func Page(tableName string, filterFields []string, db *gorm.DB, ns schema.Namer) *page
- func PasswordHash(password string) (string, error)
- func PasswordVerify(password, hash string) bool
- func SetString(arr []string) []string
- func SliceRemove(slice []string, index int) []string
- func StrSliceToMap(items []string) map[string]struct{}
- func ToFirstLower(str string) string
- func ToFirstUpper(str string) string
- func UnderToCamel(str string) string
- type DataListParams
- type ListParams
- type ModelFieldOption
- type Result
- type TreeRes
Constants ¶
View Source
const ( TopLeft int = iota TopRight BottomLeft BottomRight Center )
水印的位置
Variables ¶
This section is empty.
Functions ¶
func InterfaceToInt ¶
func InterfaceToInt(val interface{}) int
InterfaceToInt interface类型转换成int
参数: val 需要转换的值
Types ¶
type DataListParams ¶
type DataListParams struct {
Data *ListParams `json:"data" form:"data"`
}
DataListParams 列表参数 用data包裹一下
type ListParams ¶
type ListParams struct { Keywords string `json:"keywords" form:"keywords"` //搜索关键字 OrderField string `json:"order_field" form:"order_field"` //列表排序字段 OrderSort string `json:"order_sort" form:"order_sort"` //字段排序方式 (desc 倒序, asc升序) Page int `json:"page" form:"page"` //列表当前页码 PageSize int `json:"page_size" form:"page_size"` //列表每页显示条数 Action string `json:"action" form:"action"` //请求动作 Filter map[string]interface{} `json:"filter" form:"filter"` //精确多字段过滤查询 }
ListParams 列表参数
type ModelFieldOption ¶
ModelFieldOption 存储模型字段选项
func FormatTree ¶
func FormatTree(tree []*ModelFieldOption, db *gorm.DB, tableName string, filter map[string]interface{}, pk string, pid int, label string, pidField string, orderField string, level int) []*ModelFieldOption
FormatTree 格式化下拉树型列表
参数: tree map 存储返回的结果 tableName string 表名 filter string 过滤条件 pk string 主键字段名称 pid int 父级ID label string 标题字段名 pidField string 父级字段名 orderField string 排序字段名 level int 层级数 返回值:map
Click to show internal directories.
Click to hide internal directories.