Documentation
¶
Index ¶
- func GetAlertUsers(w *prometheus.WebhookAlert, pos database.AlertPosition, ...) *set.Set[uint]
- type MessageSwitcher
- func (ms *MessageSwitcher) DeRegistUser(user *NotifyUser)
- func (ms *MessageSwitcher) DispatchMessage(msg *msgbus.NotifyMessage)
- func (ms *MessageSwitcher) RegistUser(user *NotifyUser)
- func (ms *MessageSwitcher) Send(user *NotifyUser, msg *msgbus.NotifyMessage) error
- func (ms *MessageSwitcher) SendMessageToUser(msg *msgbus.NotifyMessage, userid uint)
- type NotifyUser
- type ResID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAlertUsers ¶ added in v1.22.0
func GetAlertUsers(w *prometheus.WebhookAlert, pos database.AlertPosition, database *database.Database) *set.Set[uint]
map 效率更高
Types ¶
type MessageSwitcher ¶
type MessageSwitcher struct { DataBase *database.Database Users []*NotifyUser }
func NewMessageSwitch ¶
func NewMessageSwitch(_ context.Context, db *database.Database) *MessageSwitcher
func (*MessageSwitcher) DeRegistUser ¶
func (ms *MessageSwitcher) DeRegistUser(user *NotifyUser)
func (*MessageSwitcher) DispatchMessage ¶
func (ms *MessageSwitcher) DispatchMessage(msg *msgbus.NotifyMessage)
func (*MessageSwitcher) RegistUser ¶
func (ms *MessageSwitcher) RegistUser(user *NotifyUser)
func (*MessageSwitcher) Send ¶
func (ms *MessageSwitcher) Send(user *NotifyUser, msg *msgbus.NotifyMessage) error
func (*MessageSwitcher) SendMessageToUser ¶
func (ms *MessageSwitcher) SendMessageToUser(msg *msgbus.NotifyMessage, userid uint)
type NotifyUser ¶
type NotifyUser struct { Username string UserID uint RWLock sync.RWMutex CurrentWatch map[string]map[string][]string Conn *websocket.Conn SessionID string // contains filtered or unexported fields }
func NewNotifyUser ¶
func NewNotifyUser(conn *websocket.Conn, username string, userid uint) *NotifyUser
func (*NotifyUser) CloseConn ¶
func (nu *NotifyUser) CloseConn()
func (*NotifyUser) IsWatchObject ¶
func (nu *NotifyUser) IsWatchObject(msg *msgbus.NotifyMessage) bool
func (*NotifyUser) Read ¶
func (nu *NotifyUser) Read(into interface{}) error
func (*NotifyUser) SetCurrentWatch ¶
func (nu *NotifyUser) SetCurrentWatch(w map[string]map[string][]string)
func (*NotifyUser) Write ¶
func (nu *NotifyUser) Write(data interface{}) error
Click to show internal directories.
Click to hide internal directories.