Documentation ¶
Index ¶
- func DelRdValue(key string) (int64, error)
- func EmqxApiPublish(emqxCfg *config.EmqxConf, params *EmqxParamsConf)
- func GetClient(addr, username, password, database, precision string) client.Client
- func GetMqttClient(broker_, username_, password_ string, defaultHandler mqtt.MessageHandler) mqtt.Client
- func GetRdValue(key string) (string, error)
- func GetRedisClient(addr, password string, db int) *redis.Client
- func MqttSend(topic string, payload interface{}, qos_ byte) error
- func MqttSubscribe(broker_, username_, password_, topic_ string, qos_ byte, ...) error
- func SelectInflux(sn, sql string, database, prefix string) (res []client.Result, err1 error)
- func SetRdValue(key string, value interface{}) error
- func SetRdValueTimeout(key string, value interface{}, expiration time.Duration) error
- func SubscribeKeyExpired(fc RedisKeyExpiredFunc) error
- func WirteInflux(sn string, productKey string, status int64, fields map[string]interface{}, ...) (string, error)
- type EmqxParamsConf
- type RabbitMQ
- func NewRabbitMQ(queuename string, exchange string, key string, mqurl string) *RabbitMQ
- func NewRabbitMQPubSub(exchangeName string, mqurl string) *RabbitMQ
- func NewRabbitMQRouting(exchagne string, routingKey string, mqurl string) *RabbitMQ
- func NewRabbitMQSimple(queueName string, mqurl string) *RabbitMQ
- func NewRabbitMQTopic(exchagne string, routingKey string, mqurl string) *RabbitMQ
- func (r *RabbitMQ) ConsumeSimple(fc recieveMsgFunc)
- func (r *RabbitMQ) Destory()
- func (r *RabbitMQ) PublishPub(message string)
- func (r *RabbitMQ) PublishRouting(message string)
- func (r *RabbitMQ) PublishSimple(message string)
- func (r *RabbitMQ) PublishTopic(message string)
- func (r *RabbitMQ) RecieveRouting()
- func (r *RabbitMQ) RecieveSub(fc recieveMsgFunc)
- func (r *RabbitMQ) RecieveTopic()
- type RedisKeyExpiredFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelRdValue ¶
func EmqxApiPublish ¶
func EmqxApiPublish(emqxCfg *config.EmqxConf, params *EmqxParamsConf)
EmqxApiPublish 使用emqx自带api服务,便于业务管理后台操作
func GetMqttClient ¶
func GetMqttClient(broker_, username_, password_ string, defaultHandler mqtt.MessageHandler) mqtt.Client
func GetRdValue ¶
func GetRedisClient ¶
func MqttSubscribe ¶
func MqttSubscribe(broker_, username_, password_, topic_ string, qos_ byte, defaultHandler mqtt.MessageHandler) error
func SelectInflux ¶
SelectInflux sql是赛选条件,例:`LIMIT 10`
func SetRdValue ¶
func SetRdValueTimeout ¶
func SubscribeKeyExpired ¶
func SubscribeKeyExpired(fc RedisKeyExpiredFunc) error
Types ¶
type EmqxParamsConf ¶
type RabbitMQ ¶
type RabbitMQ struct { //队列名称 QueueName string //交换机 Exchange string //key Simple模式 几乎用不到 Key string //连接信息 Mqurl string // contains filtered or unexported fields }
func NewRabbitMQ ¶
NewRabbitMQ 创建RabbitMQ结构体实例
func NewRabbitMQPubSub ¶
NewRabbitMQPubSub 订阅模式创建rabbitmq实例
func NewRabbitMQRouting ¶
NewRabbitMQRouting 路由模式 创建RabbitMQ实例
func NewRabbitMQSimple ¶
NewRabbitMQSimple 简单模式step:1。创建简单模式下RabbitMQ实例
func NewRabbitMQTopic ¶
NewRabbitMQTopic 话题模式 创建RabbitMQ实例
func (*RabbitMQ) ConsumeSimple ¶
func (r *RabbitMQ) ConsumeSimple(fc recieveMsgFunc)
ConsumeSimple 修改简单模式,其实支持外部函数调用
func (*RabbitMQ) PublishRouting ¶
PublishRouting 路由模式发送信息
func (*RabbitMQ) PublishSimple ¶
PublishSimple 简单模式Step:2、简单模式下生产代码
func (*RabbitMQ) PublishTopic ¶
PublishTopic 话题模式发送信息
func (*RabbitMQ) RecieveTopic ¶
func (r *RabbitMQ) RecieveTopic()
RecieveTopic 话题模式接收信息 要注意key 其中* 用于匹配一个单词,#用于匹配多个单词(可以是零个) 匹配 表示匹配imooc.* 表示匹配imooc.hello,但是imooc.hello.one需要用imooc.#才能匹配到
type RedisKeyExpiredFunc ¶
type RedisKeyExpiredFunc func(string)
Click to show internal directories.
Click to hide internal directories.