Documentation ¶
Overview ¶
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Index ¶
- Variables
- func CreateConsumer(topic Topic, channel Chanel, handler nsq.Handler) (c *nsq.Consumer, err error)
- func DeferredPublish(topic Topic, delay time.Duration, message []byte) (err error)
- func Publish(topic Topic, message []byte) (err error)
- func PublishCheckUserLogin(userID string) error
- func PublishNotifyToAllUser(title string, content string, delay time.Duration, data map[string]interface{}) error
- func PublishNotifyToSpecificUser(userId []string, title string, content string, delay time.Duration, ...) error
- func PublishSystemNotify(notificationID string) error
- type BodySendActivationEmail
- type BodySendNotify
- type Chanel
- type PayloadPublishCheckUserLoginStatus
- type PayloadPublishSystemNotification
- type PayloadToAllUsers
- type PayloadToSpecificUsers
- type Topic
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TopicSendEmail Topic = "topic_send_email" ChanelSendEmail Chanel = "chanel_send_email" TopicPushNotify Topic = "topic_push_notify" ChanelPushNotify Chanel = "chanel_push_notify" Address = net.JoinHostPort(config.MessageQueue.Host, config.MessageQueue.Port) // 消息队列地址 Config *nsq.Config // 消息队列的配置 )
Functions ¶
func CreateConsumer ¶
创建消费者
func DeferredPublish ¶
func PublishNotifyToAllUser ¶
func PublishNotifyToAllUser(title string, content string, delay time.Duration, data map[string]interface{}) error
发送到消息队列 - 发送推送给所有用户
Types ¶
type BodySendActivationEmail ¶
type BodySendNotify ¶
type BodySendNotify struct { Event notify.Event `json:"event" valid:"required"` // 事件名称 Payload interface{} `json:"payload" valid:"required"` // 数据体 }
func (*BodySendNotify) ToByte ¶
func (c *BodySendNotify) ToByte() ([]byte, error)
type PayloadPublishCheckUserLoginStatus ¶
type PayloadPublishCheckUserLoginStatus struct {
UserID string `json:"user_id" valid:"required"`
}
type PayloadPublishSystemNotification ¶
type PayloadPublishSystemNotification struct {
NotificationID string `json:"notification_id" valid:"required"`
}
type PayloadToAllUsers ¶
type PayloadToSpecificUsers ¶
Click to show internal directories.
Click to hide internal directories.