utils

package
v0.0.0-...-1efb92b Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JWT *jwt.JWT

Functions

func Base64Decode

func Base64Decode(s string) ([]byte, error)

Base64解码

func Base64Encode

func Base64Encode(data []byte) string

Base64编码

func Base64URLDecode

func Base64URLDecode(s string) ([]byte, error)

Base64URL解码

func Base64URLEncode

func Base64URLEncode(data []byte) string

Base64URL编码

func CheckImgCaptcha

func CheckImgCaptcha(cache *cache.Cache, captchaID string, code string) bool

func GenerateID

func GenerateID() string

func GenerateRandNum

func GenerateRandNum(digits int) string

func GetAuthModel

func GetAuthModel(ctx context.Context) (enum.AuthJWT, error)

GetAuthModel GetAuthModel

func GetContentTypeByFileName

func GetContentTypeByFileName(filename string) (string, string)

func GetDefaultHttpClient

func GetDefaultHttpClient(timeout int) *http.Client

func GetPassword

func GetPassword(password string, sale string) string

func GetRequestIdByContext

func GetRequestIdByContext(ctx context.Context) string

func GetTokenByContext

func GetTokenByContext(ctx context.Context) (tokenString string, ok bool)

func GetTokenFromHeader

func GetTokenFromHeader(header http.Header) (tokenString string, ok bool)

func GetUserInformationFromContext

func GetUserInformationFromContext(ctx context.Context) (*enum.AuthJWT, error)

func InitJWT

func InitJWT()

func InitPgSQL

func InitPgSQL(pgConf conf.PostgresConfiguration) (*gorm.DB, error)

func Md5Encode

func Md5Encode(str string) string

获取md5

func PrintObj

func PrintObj(obj interface{})

func RandKey

func RandKey(ln int) string

func RandSMSCode

func RandSMSCode(ln int) string

func UploadFile

func UploadFile(w http.ResponseWriter, r *http.Request)

func XRand

func XRand(max int, min int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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