Documentation ¶
Index ¶
- Constants
- func DelDistributedLock(redisKey, redisValue string) error
- func ExistKey(redisKey string) bool
- func GenToken(userToken *UserToken) (string, error)
- func GetDistributedLock(redisKey, redisValue string) bool
- func GetKey(redisKey string) (string, error)
- func GetMySQLClient() *gorm.DB
- func GetParamPostOrGet(c *gin.Context, param string) string
- func GetRedisClient() (*redis.Client, error)
- func GetRedisComment() ([]model.Comment, []model.Comment, map[int64]int64)
- func GetRedisFollow() ([]model.Follow, map[string]map[string]interface{})
- func GetRedisLike() ([]model.Like, map[int64]int64)
- func HGetKey(redisKey, redisField string) (string, error)
- func JWTAuth() func(c *gin.Context)
- func SetKey(redisKey, value string) (string, error)
- func UpdateRedisComment(acType string, comment model.Comment) error
- func UpdateRedisFollow(acType string, usera, userb model.User) error
- func UpdateRedisLike(likeKey, vID, acType string) error
- type UserClaims
- type UserToken
Constants ¶
View Source
const TokenExpireDuration = time.Hour * 2 //定义JWT的过期时间:2小时
Variables ¶
This section is empty.
Functions ¶
func GetDistributedLock ¶
若获取不到锁,则设置等待时间,超时则返回失败
func GetMySQLClient ¶
func GetParamPostOrGet ¶
发现post和get有时候与给的不一致
func GetRedisComment ¶
返回 新增评论和删除评论的ID
func GetRedisFollow ¶
返回 关注信息 和 用户ID:关注数和粉丝数
func UpdateRedisComment ¶
新增评论与删除评论 需要保证结构体必须 有评论ID和视频ID
func UpdateRedisFollow ¶
关注操作,关注与取关;传进来的两个用户模型必须携带用户ID、关注数、粉丝数
func UpdateRedisLike ¶
点赞 && 取消点赞 功能 key的过期时间设置为2min,0代表不会过期
Types ¶
Click to show internal directories.
Click to hide internal directories.