Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Env = []templates.Environment{
{Name: "PublisherAddress", Type: "string", Env: "PUBLISHER_ADDR", Default: "amqp://guest:guest@localhost:5672"},
{Name: "PublisherExchange", Type: "string", Env: "PUBLISHER_EXCHANGE"},
{Name: "PublisherRoutingKey", Type: "string", Env: "PUBLISHER_ROUTING_KEY"},
}
View Source
var Libs = []templates.Library{
{Name: "github.com/streadway/amqp"},
{Name: "errors"},
}
View Source
var Models = map[string]string{
"RabbitMq": `
type RabbitMq struct {
Connection *amqp.Connection
Channel *amqp.Channel
Queue *amqp.Queue
}`,
}
View Source
var Props = []templates.Property{
{Name: "Publisher", Type: "*RabbitMq", Default: "new(RabbitMq)"},
}
View Source
var TemplateRunFunction = ""
View Source
var TemplateSetter = `` /* 178-byte string literal not displayed */
View Source
var TemplateSetterFunction = `` /* 541-byte string literal not displayed */
View Source
var Templates = map[string]string{
"app/publish.go": `package app
import (
"github.com/streadway/amqp"
)
func (a *Application) publish(body []byte) error {
return a.Publisher.Channel.Publish(
a.Config.PublisherExchange, // publish to an exchange
a.Config.PublisherRoutingKey, // routing to 0 or more queues
false, // mandatory
false, // immediate
amqp.Publishing{
Headers: amqp.Table{},
ContentType: "text/plain",
ContentEncoding: "",
Body: body,
DeliveryMode: amqp.Persistent, // 1=non-persistent, 2=persistent
Priority: 0, // 0-9
// a bunch of application/implementation-specific fields
},
)
}
`,
}
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.