utils

package
v0.0.0-...-62252a8 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MulanPSL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NumberOutOfRange = errors.New("num is great than 67108864")
	CodeIsInvalid    = errors.New("code is invalid")
)
View Source
var (
	JwtUtil = &jwtUtil{}
)
View Source
var LoginUtil = &loginUtil{}

Functions

func CheckFileIsExist

func CheckFileIsExist(filename string) bool

func CopyNotEmptyProperties

func CopyNotEmptyProperties(source interface{}, dest interface{})

func CopyProperties

func CopyProperties(source interface{}, dest interface{})

func FloatRound

func FloatRound(number float64) float64

func GenerateNumString

func GenerateNumString(num int) string

func GetKeys

func GetKeys(m map[string]interface{}) []string

func GetMd5Value

func GetMd5Value(data string) string

func GetPkgRealPath

func GetPkgRealPath(pkgPath string) string

func GetSha1Value

func GetSha1Value(data string) string

func GetSha256Value

func GetSha256Value(data string) string

func HideMiddleStr

func HideMiddleStr(str string, startLen int, endLen int, replaceLetter ...string) string

func IF

func IF(condition bool, trueValue interface{}, falseValue interface{}) interface{}

func InArray

func InArray(arr interface{}, v interface{}) bool

func InitJwt

func InitJwt(config *JwtConfig)

func IsInSameDate

func IsInSameDate(time1, time2 interface{}) bool

func IsNotBlank

func IsNotBlank(str string, msg string) error

func NumberDecry

func NumberDecry(code string) (int64, error)

code 解码

func NumberEncry

func NumberEncry(num int64) (string, error)

func ParseCode2Num

func ParseCode2Num(code string) int

func ParseFloat64

func ParseFloat64(v interface{}) (rt float64, err error)

func ParseInt

func ParseInt(v interface{}) (rt int, err error)

func ParseInt64

func ParseInt64(v interface{}) (rt int64, err error)

func ParseInt64OrDefault

func ParseInt64OrDefault(v interface{}, defaultValue int64) (rt int64)

func ParseIntOrDefault

func ParseIntOrDefault(v interface{}, defaultValue int) (rt int)

func ParseString

func ParseString(v interface{}) string

func RandomStr

func RandomStr(width int) string

func SendAliCheckSms

func SendAliCheckSms(telephone string, checkCode string, templateCode string) (string, error)

func Struct2Map

func Struct2Map(structName interface{}) map[string]interface{}

func Yuan2CentVal

func Yuan2CentVal(value float64) int

Types

type JwtConfig

type JwtConfig struct {
	Secret     []byte
	JwtDueTime time.Duration
}

type LoginUser

type LoginUser struct {
	Id int
	// 状态,0:未授权,1:已授权
	Status     int
	SessionKey string
	CreateTime int64 // token 创建时间
	Extra      interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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