model

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EmptyMailRequest for not found case
	EmptyMailRequest = MailRequest{}
)

Functions

func ConvertDeliveryToPublishing added in v1.12.0

func ConvertDeliveryToPublishing(message amqp.Delivery) amqp.Publishing

ConvertDeliveryToPublishing convert a delivery to a publishing, for requeuing

func LoggedCloser added in v1.11.0

func LoggedCloser(closer io.Closer)

LoggedCloser closes a ressources with handling error

Types

type AMQPClient added in v1.12.0

type AMQPClient struct {
	// contains filtered or unexported fields
}

AMQPClient wraps all object required for AMQP usage

func GetAMQPClient added in v1.12.0

func GetAMQPClient(uri, exchangeName, queueName string) (client *AMQPClient, err error)

GetAMQPClient inits AMQP connection, channel and queue

func (*AMQPClient) ClientName added in v1.12.1

func (a *AMQPClient) ClientName() string

ClientName returns client name

func (*AMQPClient) Close added in v1.12.0

func (a *AMQPClient) Close()

Close closes opened ressources

func (*AMQPClient) Enabled added in v1.12.0

func (a *AMQPClient) Enabled() bool

Enabled checks if connection is setup

func (*AMQPClient) ExchangeName added in v1.12.0

func (a *AMQPClient) ExchangeName() string

ExchangeName returns exchange name

func (*AMQPClient) GetGarbage added in v1.12.0

func (a *AMQPClient) GetGarbage() (amqp.Delivery, bool, error)

GetGarbage get a message from the garbage

func (*AMQPClient) Listen added in v1.12.0

func (a *AMQPClient) Listen() (<-chan amqp.Delivery, error)

Listen listen to queue

func (*AMQPClient) LoggedAck added in v1.16.8

func (a *AMQPClient) LoggedAck(message amqp.Delivery)

LoggedAck ack a message with error handling

func (*AMQPClient) LoggedReject added in v1.16.8

func (a *AMQPClient) LoggedReject(message amqp.Delivery, requeue bool)

LoggedReject reject a message with error handling

func (*AMQPClient) Ping added in v1.12.0

func (a *AMQPClient) Ping() error

Ping checks if connection is live

func (*AMQPClient) QueueName added in v1.12.0

func (a *AMQPClient) QueueName() string

QueueName returns queue name

func (*AMQPClient) Send added in v1.12.0

func (a *AMQPClient) Send(payload amqp.Publishing) error

Send sends payload to the underlying exchange and queue

func (*AMQPClient) Vhost added in v1.12.0

func (a *AMQPClient) Vhost() string

Vhost returns connection Vhost

type Mail

type Mail struct {
	From    string
	Sender  string
	Subject string
	Content io.Reader
	To      []string
}

Mail describe envelope of an email

type MailRequest added in v1.11.0

type MailRequest struct {
	Payload    interface{}
	Tpl        string
	FromEmail  string
	Sender     string
	Subject    string
	Recipients []string
}

MailRequest describes an email to be sent

func NewMailRequest added in v1.11.0

func NewMailRequest() *MailRequest

NewMailRequest create a new email

func (*MailRequest) As added in v1.11.0

func (mr *MailRequest) As(sender string) *MailRequest

As set sender

func (*MailRequest) Check added in v1.11.0

func (mr *MailRequest) Check() error

Check checks if current instance is valid

func (*MailRequest) ConvertToMail added in v1.11.0

func (mr *MailRequest) ConvertToMail(content io.Reader) Mail

ConvertToMail convert mail request to Mail with given content

func (*MailRequest) Data added in v1.11.0

func (mr *MailRequest) Data(payload interface{}) *MailRequest

Data set payload

func (*MailRequest) From added in v1.11.0

func (mr *MailRequest) From(fromEmail string) *MailRequest

From set from

func (*MailRequest) Template added in v1.11.0

func (mr *MailRequest) Template(Tpl string) *MailRequest

Template set template

func (*MailRequest) To added in v1.11.0

func (mr *MailRequest) To(recipients ...string) *MailRequest

To add recipients to list

func (*MailRequest) WithSubject added in v1.11.0

func (mr *MailRequest) WithSubject(subject string) *MailRequest

WithSubject set subject

type Sender

type Sender interface {
	Send(ctx context.Context, mail Mail) error
}

Sender send given email

Jump to

Keyboard shortcuts

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