Documentation ¶
Index ¶
- Constants
- Variables
- func GenErrorResp(msg string) map[string]interface{}
- func GenOkResp() map[string]interface{}
- func GenToken(user *model.UserInfo) (string, error)
- func InitMongo(mc MongoConf) *mongo.Client
- func InitRabbitMQ(rc RabbitMQConf) (*amqp.Connection, *amqp.Channel)
- func InitRedis(rc RedisConf) *redis.Client
- func InitXorm(dbtype string, mc MysqlConf) *xorm.Engine
- func UserServiceInit(ctx context.Context, client *redis.Client)
- type DistributedLock
- type DouyinTiktokClaims
- type JwtUser
- type MongoConf
- type MysqlConf
- type RabbitMQ
- type RabbitMQConf
- type RabbitmqCore
- type RedisConf
- type VFMessage
Constants ¶
View Source
const ( VideoFavoriteExchange = "douyin_video_favorite_exchange" VideoFavoriteDeadExchange = "douyin_video_favorite_exchange_dead" VideoFavoriteQueue = "douyin_video_favorite" VideoFavoriteDeadQueue = "douyin_video_favorite_dead" VideoFavoriteRoutingKey = "douyin_vf_routing" VideoFavoriteDeadRoutingKey = "douyin_vf_dead_routing" VideoFavoriteTTL = 10000 )
View Source
const ( UserLogged = "user:logged:" UserFollow = "user:follow:" UserFan = "user:fan:" UserMessageFlag = "user:message:" VideoFavorite = "video:favorite:" VideoFavoriteCnt = "video:favorite:count:" VideoFavoriteLock = "video:favorite:lock:" )
Variables ¶
View Source
var MQUrl string
View Source
var UserServiceRedis *redis.Client // 供每个服务使用的
Functions ¶
func GenErrorResp ¶
func InitRabbitMQ ¶
func InitRabbitMQ(rc RabbitMQConf) (*amqp.Connection, *amqp.Channel)
func UserServiceInit ¶
Types ¶
type DistributedLock ¶
type DistributedLock struct {
// contains filtered or unexported fields
}
func NewDistributedLock ¶
func NewDistributedLock(ctx context.Context, rc *redis.Client, Key string) *DistributedLock
func (*DistributedLock) AcquireLock ¶
func (l *DistributedLock) AcquireLock(ttl time.Duration) (bool, error)
func (*DistributedLock) ReleaseLock ¶
func (l *DistributedLock) ReleaseLock() error
type DouyinTiktokClaims ¶
type DouyinTiktokClaims struct { Id int64 `json:"id"` Name string `json:"name"` jwt.RegisteredClaims }
func ParseToken ¶
func ParseToken(token string) (*DouyinTiktokClaims, error)
type RabbitMQ ¶
type RabbitMQ struct { Conn *amqp.Connection Channel *amqp.Channel QueueName string // 队列名称 Exchange string // 交换机名称 Key string // bind Key 名称 MQUrl string // 连接信息 }
RabbitMQ rabbitMQ结构体
func NewRabbitMQ ¶
func NewRabbitMQ(queueName string, exchange string, key string, conn *amqp.Connection, channel *amqp.Channel) *RabbitMQ
NewRabbitMQ 创建结构体实例
func (*RabbitMQ) PublishTopic ¶
PublishTopic 话题模式发送消息
type RabbitmqCore ¶
type RabbitmqCore struct { Conn *amqp.Connection Channel *amqp.Channel }
Click to show internal directories.
Click to hide internal directories.