utils

package
v0.0.0-...-47b8e0f Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxKeyLoginUseID = "login_user_id"
	CtxKeyLoginToken = "login_token"
)

Variables

This section is empty.

Functions

func BindConfig

func BindConfig(filepath string, config interface{}) error

BindConfig 将 yaml 配置文件绑定到 struct 上

func Bool

func Bool(b bool) *bool

func ClearSession

func ClearSession(c *gin.Context)

ClearSession 清空session

func ComparePasswords

func ComparePasswords(hashedPwd string, plainPwd string) bool

ComparePasswords 验证密码

func DeleteSession

func DeleteSession(c *gin.Context, key string)

DeleteSession 删除session

func Float64

func Float64(f float64) *float64

func GenInt64ID

func GenInt64ID() int64

func GetSession

func GetSession(c *gin.Context, key string) interface{}

GetSession 获取session

func GetTokenFromCtx

func GetTokenFromCtx(ctx context.Context) string

func GetUserIDFromCtx

func GetUserIDFromCtx(ctx context.Context) int64

func HashAndSalt

func HashAndSalt(pwdStr string) (pwdHash string, err error)

HashAndSalt 加密密码

func Int16

func Int16(i int16) *int16

func Int32

func Int32(i int32) *int32

func Int64

func Int64(i int64) *int64

func MapToSliceInt64

func MapToSliceInt64(m map[int64]bool) []int64

func Recovery

func Recovery(ctx context.Context)

Recovery 避免 panic

func SetSession

func SetSession(c *gin.Context, fieldMap map[string]interface{})

SetSession 设置session

func SliceToMapStr

func SliceToMapStr(src []string) map[string]bool

func String

func String(s string) *string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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