Documentation ¶
Index ¶
- Constants
- Variables
- func AecDecode(str string, key string) string
- func AecEncode(str string, key string) string
- func ArrayToString(array []interface{}) string
- func AutoClearCode(filepath string, codeData string) error
- func AutoInjectionCode(filepath string, funcName string, codeData string) error
- func BreakPointContinue(content []byte, fileName string, contentNumber int, contentTotal int, ...) (error, string)
- func CheckMd5(content []byte, chunkMd5 string) (CanUpload bool)
- func ClearTable(db *gorm.DB, tableName string, compareField string, interval string) error
- func CreateDir(dirs ...string) (err error)
- func CreateFile(name string) (*os.File, error)
- func DeLFile(filePath string) error
- func Des3Decode(str string, key string) string
- func Des3Encode(str string, key string) string
- func DownloadFile(url string, localPath string, filename string) (fullPath string, err error)
- func Eq(mark string) string
- func ExecShell(s string) (string, error)
- func FileExist(path string) bool
- func FileExists(path string) bool
- func FileMove(src string, dst string) (err error)
- func GUID() string
- func Ge(mark string) string
- func GetIp() string
- func GetType(params interface{}) string
- func GetUserAuthorityId(c *gin.Context) string
- func GetUserID(c *gin.Context) int64
- func GetUserInfo(c *gin.Context) *systemReq.CustomClaims
- func GetUserUuid(c *gin.Context) uuid.UUID
- func GetWriteSyncer(file string) zapcore.WriteSyncer
- func Gt(mark string) string
- func Gz(files []*os.File, dest string) error
- func InArray(needle interface{}, hystack interface{}) bool
- func Int2Time(ts int64) *time.Time
- func IntPtr(s int) *int
- func Ip2long(ipstr string) (ip uint32)
- func IsEmpty(params interface{}) bool
- func IsEmptyStr(params string) bool
- func IsFileExist(filename string, filesize int64) bool
- func Krand(size int, kind int) string
- func Le(mark string) string
- func Long2ip(ip uint32) string
- func Lt(mark string) string
- func MD5V(str []byte, b ...byte) string
- func MakeFile(fileName string, FileMd5 string) (error, string)
- func Md5ByBytes(b []byte) string
- func Md5ByString(str string) string
- func Ne(mark string) string
- func NotEmpty() string
- func PathExists(path string) (bool, error)
- func RegexpMatch(rule string) string
- func RegisterRule(key string, rule Rules) (err error)
- func Reload() error
- func RemoveChunk(FileMd5 string) error
- func Str2Time(str string) *time.Time
- func StrToInt(str string) int
- func StrToInt64(str string) int64
- func StrToUInt(str string) uint
- func Strct2Slice(f interface{}, sheetFieldsJson []string) []interface{}
- func StringPtr(s string) *string
- func StructToMap(obj interface{}) map[string]interface{}
- func Ternary(a bool, b, c interface{}) interface{}
- func TimeSub(t1, t2 time.Time) int
- func TimeToStr(t *time.Time) string
- func TrimSpace(target interface{})
- func UUID() string
- func UUID36() string
- func UnGz(tarFile, dest string) error
- func Unzip(zipFile string, destDir string) error
- func Unzip_tx(tarFile, dest string) (path string, err error)
- func UrlQueryStrToMap(urlstr string) (map[string]interface{}, error)
- func Verify(st interface{}, roleMap Rules) (err error)
- func Zip(srcFile string, destZip string) error
- func ZipFiles(filename string, files []string, oldForm, newForm string) error
- type ExcelHelper
- type JWT
- type Rules
- type RulesMap
Constants ¶
View Source
const ( ConfigEnv = "GVA_CONFIG" ConfigFile = "config.yaml" )
View Source
const ( KC_RAND_KIND_NUM = 0 // 纯数字 KC_RAND_KIND_LOWER = 1 // 小写字母 KC_RAND_KIND_UPPER = 2 // 大写字母 KC_RAND_KIND_ALL = 3 // 数字、大小写字母 )
Variables ¶
View Source
var ( TokenExpired = errors.New("Token is expired") TokenNotValidYet = errors.New("Token not active yet") TokenMalformed = errors.New("That's not even a token") TokenInvalid = errors.New("Couldn't handle this token:") )
View Source
var ( IdVerify = Rules{"ID": {NotEmpty()}} ApiVerify = Rules{"Path": {NotEmpty()}, "Description": {NotEmpty()}, "ApiGroup": {NotEmpty()}, "Method": {NotEmpty()}} MenuVerify = Rules{"Path": {NotEmpty()}, "ParentId": {NotEmpty()}, "Name": {NotEmpty()}, "Component": {NotEmpty()}, "Sort": {Ge("0")}} MenuMetaVerify = Rules{"Title": {NotEmpty()}} LoginVerify = Rules{"CaptchaId": {NotEmpty()}, "Captcha": {NotEmpty()}, "Username": {NotEmpty()}, "Password": {NotEmpty()}} RegisterVerify = Rules{"Username": {NotEmpty()}, "NickName": {NotEmpty()}, "Password": {NotEmpty()}, "AuthorityId": {NotEmpty()}} PageInfoVerify = Rules{"Page": {NotEmpty()}, "PageSize": {NotEmpty()}} CustomerVerify = Rules{"CustomerName": {NotEmpty()}, "CustomerPhoneData": {NotEmpty()}} SuperBuilderVerify = Rules{"Abbreviation": {NotEmpty()}, "StructName": {NotEmpty()}, "PackageName": {NotEmpty()}, "Fields": {NotEmpty()}} AuthorityVerify = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {NotEmpty()}} //AuthorityVerify = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {NotEmpty()}, "ParentId": {NotEmpty()}} AuthorityIdVerify = Rules{"AuthorityId": {NotEmpty()}} OldAuthorityVerify = Rules{"OldAuthorityId": {NotEmpty()}} ChangePasswordVerify = Rules{"Password": {NotEmpty()}, "NewPassword": {NotEmpty()}} SetUserAuthorityVerify = Rules{"AuthorityId": {NotEmpty()}} )
View Source
var CustomizeMap = make(map[string]Rules)
Functions ¶
func ArrayToString ¶
func ArrayToString(array []interface{}) string
func AutoClearCode ¶
func AutoInjectionCode ¶
func BreakPointContinue ¶
func ClearTable ¶
func DownloadFile ¶
func FileExists ¶
func GetType ¶
func GetType(params interface{}) string
GetType : 获取数据类型字符串 (string, int, float64, []int, []string, map[string]int ...) GetType : (能不用则不用,由于涉及到使用reflect包,性能堪忧)
func GetUserAuthorityId ¶
从Gin的Context中获取从jwt解析出来的用户角色id
func GetUserInfo ¶
func GetUserInfo(c *gin.Context) *systemReq.CustomClaims
从Gin的Context中获取从jwt解析出来的用户角色id
func GetWriteSyncer ¶
func GetWriteSyncer(file string) zapcore.WriteSyncer
func Gz ¶
下面是 gz 文件操作------------------------------------------------------------------------------ 压缩 使用gzip压缩成tar.gz
func IsFileExist ¶
func Md5ByBytes ¶
func PathExists ¶
func RegexpMatch ¶
@author: [zooqkl](https://github.com/zooqkl) @function: RegexpMatch @description: 正则校验 校验输入项是否满足正则表达式 @param: rule string @return: string
func RegisterRule ¶
func RemoveChunk ¶
func Strct2Slice ¶
func Strct2Slice(f interface{}, sheetFieldsJson []string) []interface{}
struct 转 切片
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
func TimeSub ¶
Truncate方法用的是绝对时间,如果给出的时间为本地时间,会存在时区,会出现不同时间化为同一天的情况 两个日期间相差多少天,两个不同日期的,相差一秒都算一天 https://www.jianshu.com/p/b2efbe971105
func UrlQueryStrToMap ¶
Types ¶
type ExcelHelper ¶
type ExcelHelper struct { }
func (*ExcelHelper) ParseExcel2InfoList ¶
func (exa *ExcelHelper) ParseExcel2InfoList() ([]system.SysBaseMenu, error)
func (*ExcelHelper) ParseInfoList2Excel ¶
func (exa *ExcelHelper) ParseInfoList2Excel(infoList []system.SysBaseMenu, filePath string) error
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)
创建一个token
func (*JWT) CreateTokenByOldToken ¶
CreateTokenByOldToken 旧token 换新token 使用归并回源避免并发问题
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)
解析 token
Source Files ¶
Click to show internal directories.
Click to hide internal directories.