mem

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg config.Storage) (storage.Store, error)

New returns an emtpy memory store.

Types

type Message

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

Message is a memory store message.

func (*Message) Date

func (m *Message) Date() time.Time

Date returns the date received.

func (*Message) From

func (m *Message) From() *mail.Address

From returns the from address.

func (*Message) ID

func (m *Message) ID() string

ID the message ID.

func (*Message) Mailbox

func (m *Message) Mailbox() string

Mailbox returns the mailbox name.

func (*Message) Seen

func (m *Message) Seen() bool

Seen returns the message seen flag.

func (*Message) Size

func (m *Message) Size() int64

Size returns the message size in bytes.

func (*Message) Source

func (m *Message) Source() (io.ReadCloser, error)

Source returns a reader for the message source.

func (*Message) Subject

func (m *Message) Subject() string

Subject returns the subject line.

func (*Message) To

func (m *Message) To() []*mail.Address

To returns the to address list.

type Store

type Store struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Store implements an in-memory message store.

func (*Store) AddMessage

func (s *Store) AddMessage(message storage.Message) (id string, err error)

AddMessage stores the message, message ID and Size will be ignored.

func (*Store) GetMessage

func (s *Store) GetMessage(mailbox, id string) (m storage.Message, err error)

GetMessage gets a mesage.

func (*Store) GetMessages

func (s *Store) GetMessages(mailbox string) (ms []storage.Message, err error)

GetMessages gets a list of messages.

func (*Store) MarkSeen

func (s *Store) MarkSeen(mailbox, id string) error

MarkSeen marks a message as having been read.

func (*Store) PurgeMessages

func (s *Store) PurgeMessages(mailbox string) error

PurgeMessages deletes the contents of a mailbox.

func (*Store) RemoveMessage

func (s *Store) RemoveMessage(mailbox, id string) error

RemoveMessage deletes a single message.

func (*Store) VisitMailboxes

func (s *Store) VisitMailboxes(f func([]storage.Message) (cont bool)) error

VisitMailboxes visits each mailbox in the store.

Jump to

Keyboard shortcuts

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