nats

package
v0.0.0-...-ddfd2c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Broker *nats.EncodedConn = nil

Functions

func Connect

func Connect(conf *config.ViperConfig) error

连接 nats 服务器

func Drain

func Drain()

关闭连接

func PublishEvent

func PublishEvent(level int, title, content string) error

发布事件到消息队列

func PublishNotification

func PublishNotification(user, title, content string, ntype int) error

发布用户通知

Types

type Event

type Event struct {
	Level   int    `json:"level"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

type Notification

type Notification struct {
	Type    int    `json:"type"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL