Documentation ¶
Index ¶
- Constants
- Variables
- func BcryptCheck(password, hash string) bool
- func BcryptHash(password string) string
- func CreateDir(dirs ...string) (err error)
- func DelFile(filePath string) error
- func Eq(mark string) string
- func FileExist(filePath string) bool
- func FileMove(src string, dst string) (err error)
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func Ge(mark string) string
- func GetClaims(c *gin.Context) (*systemReq.CustomClaims, error)
- func GetUseID(c *gin.Context) uint
- func GetUseUuid(c *gin.Context) uuid.UUID
- func GetUserRoleId(c *gin.Context) uint
- func GetWriteSyncer(file string) zapcore.WriteSyncer
- func Gt(mark string) string
- func Le(mark string) string
- func Lt(mark string) string
- func MD5(str []byte, b ...byte) string
- func MaheHump(s string) string
- func Ne(mark string) string
- func NotEmpty() string
- func PathExists(path string) (bool, error)
- func Pointer[T any](in T) (out *T)
- func RandomInt(min, max int) int
- func RandomString(n int) string
- func RegexpMatch(rule string) string
- func RegisterRule(key string, rule Rules) (err error)
- func StructToMap(v interface{}) map[string]interface{}
- func TrimSpace(target interface{})
- func Unzip(zipFile string, destDir string) ([]string, error)
- func Verify(st interface{}, roleMap Rules) (err error)
- func ZipFiles(filename string, files []string, oldForm, newForm string) error
- type Cpu
- type Disk
- type JWT
- func (j *JWT) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims
- func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)
- func (j *JWT) CreateTokenByOldToken(oldToken string, claims request.CustomClaims) (string, error)
- func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)
- type Os
- type Ram
- type Rules
- type RulesMap
- type Server
Constants ¶
View Source
const ( CONFIG_ENV = "CONFIG" CONFIG_FILE = "config.yaml" )
View Source
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
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 CustomizeMap = make(map[string]Rules)
Functions ¶
func BcryptCheck ¶
func FirstLower ¶
func FirstUpper ¶
func GetUserRoleId ¶
func GetWriteSyncer ¶
func GetWriteSyncer(file string) zapcore.WriteSyncer
func PathExists ¶
func RegexpMatch ¶
func RegisterRule ¶
func StructToMap ¶
func StructToMap(v interface{}) map[string]interface{}
StructToMap @author: [Shansec](https://github.com/shansec) @function: StructToMap @description: 结构体转 Map @param: v interface{} @return: map[string]interface{}
Types ¶
type Cpu ¶
func InitCPU ¶
InitCPU @author: [Shansec](https://github.com/shansec) @function: InitCPU @description: CPU信息 @return: c Cpu, err error
type Disk ¶
type Disk struct { UsedMB int `json:"usedMb"` UsedGB int `json:"usedGb"` TotalMB int `json:"totalMb"` TotalGB int `json:"totalGb"` UsedPercent int `json:"usedPercent"` }
func InitDisk ¶
InitDisk @author: [Shansec](https://github.com/shansec) @function: InitDisk @description: 硬盘信息 @return: d Disk, err error
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)
CreateToken 创建一个 token
func (*JWT) CreateTokenByOldToken ¶
CreateTokenByOldToken 根据旧 token 生成新的 token
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)
ParseToken 解析 token
type Os ¶
type Os struct { GOOS string `json:"goos"` NumCPU int `json:"numCpu"` Compiler string `json:"compiler"` GoVersion string `json:"goVersion"` NumGoroutine int `json:"numGoroutine"` }
func InitOS ¶
func InitOS() (o Os)
InitOS @author: [Shansec](https://github.com/shansec) @function: InitCPU @description: OS信息 @return: o Os, err error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.