messagesStorageMongo

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT-0 Imports: 13 Imported by: 1

README

MailHedgehog package to save messages in MongoDB storage

All emails stored in MongoDB database. Useful if you have a lot of emails in application.

Usage

storage := CreateMongoDbStorage(createMongoTestCollection(), &contracts.MessagesStorageConfiguration{PerRoomLimit: 100})

msg, err := storage.MessagesRepo(room).Load("ID")

Development

go mod tidy
go mod verify
go mod vendor

Test

docker-compose up -d
go test --cover

Credits

  • Think Studio

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID      smtpMessage.MessageID    `bson:"id"`
	Room    string                   `bson:"room"`
	From    []*mail.Address          `bson:"from"`
	To      []*mail.Address          `bson:"to"`
	Subject string                   `bson:"subject"`
	Date    time.Time                `bson:"date"`
	Message *smtpMessage.SmtpMessage `bson:"message"`
}

type Mongo

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

func CreateMongoDbStorage

func CreateMongoDbStorage(collection *mongo.Collection, storageConfig *contracts.MessagesStorageConfiguration) *Mongo

func (*Mongo) MessagesRepo

func (repo *Mongo) MessagesRepo(room contracts.Room) contracts.MessagesRepo

func (*Mongo) RoomsRepo

func (repo *Mongo) RoomsRepo() contracts.RoomsRepo

Jump to

Keyboard shortcuts

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