utils

package
v0.0.0-...-f53b5d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IdVerify               = Rules{"Ids": []string{NotEmpty()}}
	ApiVerify              = Rules{"Path": {NotEmpty()}, "Description": {NotEmpty()}, "ApiGroup": {NotEmpty()}, "Method": {NotEmpty()}}
	MenuVerify             = Rules{"Path": {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()}, "AuthorityId": {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()}}
	AuthorityVerify        = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {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 BcryptCheck

func BcryptCheck(password, hash string) bool

BcryptCheck 对比明文密码和数据库的哈希值

func BcryptHash

func BcryptHash(password string) string

BcryptHash 使用 bcrypt 对密码进行加密

func BreakPointContinue

func BreakPointContinue(content []byte, fileName string, contentNumber int, contentTotal int, fileMd5 string) (string, error)

func CheckMd5

func CheckMd5(content []byte, chunkMd5 string) (CanUpload bool)

func Eq

func Eq(mark string) string

func Ge

func Ge(mark string) string

func Gt

func Gt(mark string) string

func Le

func Le(mark string) string

func Lt

func Lt(mark string) string

func MD5V

func MD5V(str []byte, b ...byte) string

func MakeFile

func MakeFile(fileName string, FileMd5 string) (string, error)

func Ne

func Ne(mark string) string

func NotEmpty

func NotEmpty() string

func ParseDuration

func ParseDuration(d string) (time.Duration, error)

func RegexpMatch

func RegexpMatch(rule string) string

func RegisterRule

func RegisterRule(key string, rule Rules) (err error)

func RemoveChunk

func RemoveChunk(FileMd5 string) error

func Verify

func Verify(st interface{}, roleMap Rules) (err error)

Types

type Rules

type Rules map[string][]string

type RulesMap

type RulesMap map[string]Rules

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL