Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayToString(array []interface{}) string
- func BcryptCheck(password, hash string) bool
- func BcryptHash(password string) string
- func BreakPointContinue(content []byte, fileName string, contentNumber int, contentTotal int, ...) (string, error)
- func CheckMd5(content []byte, chunkMd5 string) (CanUpload bool)
- func CheckSpace(r rune) bool
- func DbPing(dbType string, dsn string) error
- func DeLFile(filePath string) error
- func Eq(mark string) string
- func EtcdGet(cli *clientv3.Client, key string) (*clientv3.GetResponse, error)
- func EtcdPut(cli *clientv3.Client, key string, msg string) error
- func FileExist(path string) bool
- func FileMove(src string, dst string) (err error)
- func FindDataLen(s string) (int, error)
- func FindDataType(s string) string
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func Ge(mark string) string
- func GetStructFloat64Field(input interface{}, key string) (value float64, err error)
- func GetStructStringField(input interface{}, key string) (value string, err error)
- func GetStructTagName(i interface{}, fieldName string) []string
- func GetStructTagNameRegex(i interface{}, fieldName string, regStr string) []string
- func GetUserID(c *gin.Context, key string) uint
- func GetUserRoleId(c *gin.Context, key string) uint
- func GetUserUuid(c *gin.Context, key string) uuid.UUID
- func Gt(mark string) string
- func IntDif(int1, int2 []int) []int
- func InterfaceToInt(v interface{}) (i int)
- func Le(mark string) string
- func Lt(mark string) string
- func MD5V(str []byte, b ...byte) string
- func MaheHump(s string) string
- func MakeFile(fileName string, FileMd5 string) (string, error)
- func Ne(mark string) string
- func NotEmpty() string
- func ReadCsv(filePath string) (res [][]string, err error)
- func ReadXls(filePath string) (res [][]string, err error)
- func ReadXlsx(filePath string) (res [][]string, err error)
- func RegexpMatch(rule string) string
- func RegisterRule(key string, rule Rules) (err error)
- func RemoveChunk(FileMd5 string) error
- func StringDifference(string1, string2 []string) []string
- func StringIntersect(string1, string2 []string) []string
- func StructToMap(obj interface{}) map[string]interface{}
- func SubAfter(s, sep, def string) string
- func SubAfterLast(s, sep, def string) string
- func SubBefore(s, sep, def string) string
- func SubBeforeLast(s, sep, def string) string
- func TrimBoth(s, trim string) string
- func TrimEnd(s, trim string) string
- func TrimSpace(target interface{})
- func TrimStart(s, trim string) string
- func Unzip(zipFile string, destDir string) ([]string, error)
- func ValidUTF8(buf []byte) bool
- func Verify(st interface{}, roleMap Rules) (err error)
- func ZipFiles(filename string, files []string, oldForm, newForm string) error
- type BaseClaims
- type CustomClaims
- type JWT
- func (j *JWT) CreateClaims(baseClaims BaseClaims, bufferTime string, expiresTime string, issuer string) CustomClaims
- func (j *JWT) CreateToken(claims CustomClaims) (string, error)
- func (j *JWT) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)
- func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
- type Rules
- type RulesMap
Constants ¶
View Source
const ( REGEX_COMMENT_VALUE = `comment:'(.*?)'` FIELD_JSON_VALUE = "json" FIELD_GORM_VALUE = "gorm" )
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": []string{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()}, "Username": {NotEmpty()}, "Password": {NotEmpty()}} RegisterVerify = Rules{"Username": {NotEmpty()}, "NickName": {NotEmpty()}, "Password": {NotEmpty()}, "RoleId": {NotEmpty()}} PageInfoVerify = Rules{"Page": {NotEmpty()}, "PageSize": {NotEmpty()}} CustomerVerify = Rules{"CustomerName": {NotEmpty()}, "CustomerPhoneData": {NotEmpty()}} AutoCodeVerify = Rules{"Abbreviation": {NotEmpty()}, "StructName": {NotEmpty()}, "PackageName": {NotEmpty()}, "Fields": {NotEmpty()}} AutoPackageVerify = Rules{"PackageName": {NotEmpty()}} RoleVerify = Rules{"RoleId": {NotEmpty()}, "RoleName": {NotEmpty()}} RoleIdVerify = Rules{"RoleId": {NotEmpty()}} OldRoleVerify = Rules{"OldRoleId": {NotEmpty()}} ChangePasswordVerify = Rules{"Password": {NotEmpty()}, "NewPassword": {NotEmpty()}} SetUserRoleVerify = Rules{"RoleId": {NotEmpty()}} )
View Source
var CustomizeMap = make(map[string]Rules)
Functions ¶
func ArrayToString ¶
func ArrayToString(array []interface{}) string
func BcryptCheck ¶
func BcryptHash ¶
func BreakPointContinue ¶
func CheckSpace ¶
func FindDataLen ¶
func FindDataType ¶
func FirstLower ¶
func FirstUpper ¶
func GetStructFloat64Field ¶
func GetStructStringField ¶
func GetStructTagName ¶
func GetStructTagNameRegex ¶
func InterfaceToInt ¶
func InterfaceToInt(v interface{}) (i int)
func RegexpMatch ¶
func RegisterRule ¶
func RemoveChunk ¶
func StringDifference ¶
func StringIntersect ¶
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
func SubAfterLast ¶
func SubBeforeLast ¶
Types ¶
type BaseClaims ¶
type CustomClaims ¶
type CustomClaims struct { BaseClaims BufferTime int64 jwt.RegisteredClaims }
func GetUserInfo ¶
func GetUserInfo(c *gin.Context, key string) *CustomClaims
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(baseClaims BaseClaims, bufferTime string, expiresTime string, issuer string) CustomClaims
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims CustomClaims) (string, error)
func (*JWT) CreateTokenByOldToken ¶
func (j *JWT) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.