代码拉取完成,页面将自动刷新
package rabbit
import (
"github.com/pkg/errors"
"github.com/spf13/viper"
)
// Exchange is structure with specification of properties of RabbitMQ exchange
type Exchange struct {
Durable bool `yaml:"durable"`
AutoDelete bool `yaml:"auto-delete"`
Internal bool `yaml:"internal"`
Nowait bool `yaml:"nowait"`
Type string `yaml:"type"`
Bindings []Binding `yaml:"bindings"`
Args map[string]interface{}
}
// Binding specifies to which exchange should be an exchange or a queue binded
type Binding struct {
Exchange string `yaml:"exchange"`
Key string `yaml:"key"`
Nowait bool `yaml:"nowait"`
}
// QueueSpec is a specification of properties of RabbitMQ queue
type QueueSpec struct {
Durable bool `yaml:"durable"`
AutoDelete bool `yaml:"auto-delete"`
Nowait bool `yaml:"nowait"`
Exclusive bool `yaml:"exclusive"`
Bindings []Binding `yaml:"bindings"`
}
// Settings is a specification of all queues and exchanges together with all bindings.
type Options struct {
Addresses string `yaml:"addresses"`
Username string `yaml:"username"`
Password string `yaml:"password"`
VirtualHost string `yaml:"virtual-host"`
Exchanges map[string]Exchange `yaml:"exchanges"`
Queues map[string]QueueSpec `yaml:"queues"`
}
var defaultOptions = &Options{
Addresses: "127.0.0.1",
Username: "root",
Password: "root",
VirtualHost: "/",
Exchanges: nil,
Queues: nil,
}
func NewOptions(v *viper.Viper) (*Options, error) {
if err := v.UnmarshalKey("rabbit", defaultOptions); err != nil {
return nil, errors.Wrap(err, "unmarshal rabbitmq option error")
}
return defaultOptions, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。