Documentation ¶
Index ¶
- Constants
- func MarshalDingTalkBody(staffId string, msg *DingTalkNoticeBody) (data []byte, err error)
- func MarshalWechatBody(staffId string, msg *WeChatNoticeBody) (data []byte, err error)
- type Consumer
- type DingTalkBody
- type DingTalkMsgLinkInput
- type DingTalkMsgMarkdownInput
- type DingTalkMsgPlainTextInput
- type DingTalkNoticeBody
- type NoticeTemplate
- type Producer
- type RabbitMQHeaderCarrier
- type UniNotifyInput
- type WeChatNoticeBody
- type WechatBody
Constants ¶
View Source
const ( WechatKey = "notify.wechat" DingTalkKey = "notify.dingtalk" UserIdKey = "userId" )
Variables ¶
This section is empty.
Functions ¶
func MarshalDingTalkBody ¶
func MarshalDingTalkBody(staffId string, msg *DingTalkNoticeBody) (data []byte, err error)
func MarshalWechatBody ¶
func MarshalWechatBody(staffId string, msg *WeChatNoticeBody) (data []byte, err error)
Types ¶
type Consumer ¶
type Consumer struct { Conn *amqp.Connection Channel *amqp.Channel Tag string Done chan error Deliveries <-chan amqp.Delivery }
func NewConsumer ¶
type DingTalkBody ¶
type DingTalkBody struct { StaffId string `json:"staffId"` *DingTalkNoticeBody MessageId string `json:"messageId"` }
type DingTalkMsgLinkInput ¶
type DingTalkMsgPlainTextInput ¶
type DingTalkMsgPlainTextInput struct {
Content string `json:"content"`
}
type DingTalkNoticeBody ¶
type DingTalkNoticeBody struct { MsgType string `json:"msgtype"` Text *DingTalkMsgPlainTextInput `json:"text,omitempty"` Link *DingTalkMsgLinkInput `json:"link,omitempty"` Markdown *DingTalkMsgMarkdownInput `json:"markdown,omitempty"` }
func UnmarshalDingTalkBody ¶
func UnmarshalDingTalkBody(data []byte) (*DingTalkNoticeBody, error)
func (*DingTalkNoticeBody) LinkMsg ¶
func (t *DingTalkNoticeBody) LinkMsg(messageUrl, picUrl, title, text string)
func (*DingTalkNoticeBody) MarkdownMsg ¶
func (t *DingTalkNoticeBody) MarkdownMsg(title, text string)
func (*DingTalkNoticeBody) PlainText ¶
func (t *DingTalkNoticeBody) PlainText(content string)
type NoticeTemplate ¶
type NoticeTemplate struct { StaffID []string `json:"StaffID"` WeChat *WeChatNoticeBody `json:"template,omitempty"` DingTalk *DingTalkNoticeBody `json:"dingtalk,omitempty"` // contains filtered or unexported fields }
func New ¶
func New() *NoticeTemplate
func (*NoticeTemplate) NewDingTalk ¶
func (t *NoticeTemplate) NewDingTalk() *DingTalkNoticeBody
func (*NoticeTemplate) NewWeChat ¶
func (t *NoticeTemplate) NewWeChat() *WeChatNoticeBody
func (*NoticeTemplate) Receiver ¶
func (t *NoticeTemplate) Receiver(staffId ...string) *NoticeTemplate
func (*NoticeTemplate) WithContext ¶
func (t *NoticeTemplate) WithContext(ctx context.Context) *NoticeTemplate
type Producer ¶
type Producer struct { Conn *amqp.Connection Channel *amqp.Channel // contains filtered or unexported fields }
func (*Producer) PublishNotice ¶
type RabbitMQHeaderCarrier ¶
RabbitMQHeaderCarrier adapts http.Header to satisfy the TextMapCarrier interface.
func (RabbitMQHeaderCarrier) Get ¶
func (hc RabbitMQHeaderCarrier) Get(key string) string
Get returns the value associated with the passed key.
func (RabbitMQHeaderCarrier) Keys ¶
func (hc RabbitMQHeaderCarrier) Keys() []string
Keys lists the keys stored in this carrier.
func (RabbitMQHeaderCarrier) Set ¶
func (hc RabbitMQHeaderCarrier) Set(key string, value string)
Set stores the key-value pair.
type UniNotifyInput ¶
type WeChatNoticeBody ¶
type WeChatNoticeBody struct { Data map[string]*message.TemplateDataItem `json:"data"` TemplateID string `json:"template_id"` ToUser string `json:"touser"` URL string `json:"url"` }
func (*WeChatNoticeBody) SetData ¶
func (t *WeChatNoticeBody) SetData(key, value, color string) *WeChatNoticeBody
func (*WeChatNoticeBody) SetTmpl ¶
func (t *WeChatNoticeBody) SetTmpl(templateId string) *WeChatNoticeBody
func (*WeChatNoticeBody) Url ¶
func (t *WeChatNoticeBody) Url(url string) *WeChatNoticeBody
type WechatBody ¶
type WechatBody struct { StaffId string `json:"staffId"` *WeChatNoticeBody MessageId string `json:"messageId"` }
func UnmarshalWechatBody ¶
func UnmarshalWechatBody(data []byte) (*WechatBody, error)
Click to show internal directories.
Click to hide internal directories.