courier

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueEmpty = errors.New("queue is empty")

Functions

func TestPersister

func TestPersister(p interface {
	Persister
	identity.Pool
}) func(t *testing.T)

Types

type Courier

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

func NewSMTP

func NewSMTP(d smtpDependencies, c configuration.Provider) *Courier

func (*Courier) SendEmail

func (m *Courier) SendEmail(ctx context.Context, t EmailTemplate) (uuid.UUID, error)

func (*Courier) Work

func (m *Courier) Work(ctx context.Context) error

type EmailTemplate

type EmailTemplate interface {
	EmailSubject() (string, error)
	EmailBody() (string, error)
	EmailRecipient() (string, error)
}

type Message

type Message struct {
	ID        uuid.UUID     `json:"-" faker:"-" db:"id"`
	Status    MessageStatus `json:"-" db:"status"`
	Type      MessageType   `json:"-" db:"type"`
	Recipient string        `json:"-" db:"recipient"`
	Body      string        `json:"-" db:"body"`
	Subject   string        `json:"-" db:"subject"`

	// CreatedAt is a helper struct field for gobuffalo.pop.
	CreatedAt time.Time `json:"-" faker:"-" db:"created_at"`
	// UpdatedAt is a helper struct field for gobuffalo.pop.
	UpdatedAt time.Time `json:"-" faker:"-" db:"updated_at"`
}

func (Message) TableName

func (m Message) TableName() string

type MessageStatus

type MessageStatus int
const (
	MessageStatusQueued MessageStatus = iota + 1
	MessageStatusSent
)

type MessageType

type MessageType int
const (
	MessageTypeEmail MessageType = iota + 1
)

type PersistenceProvider

type PersistenceProvider interface {
	CourierPersister() Persister
}

type Persister

type Persister interface {
	AddMessage(context.Context, *Message) error

	NextMessages(context.Context, uint8) ([]Message, error)

	SetMessageStatus(context.Context, uuid.UUID, MessageStatus) error
}

type Provider

type Provider interface {
	Courier() *Courier
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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