Documentation
¶
Overview ¶
Package db manages the queuing/persistance for the postmaster
Index ¶
- Constants
- Variables
- func GenerateEmailID(recipient string, flags int64) string
- func MarkAsBounced(id string, reason string)
- func MarkAsDelivered(id string)
- func MarkAsDropped(id string, reason string)
- func MarkAsOpened(id string)
- func MarkAsSpamReported(id string)
- func RandomizeColls()
- func StoreEmailBounce(email string) error
- func StoreEmailFlags(email string, flags int64) error
- func StoreEmailSpam(email string) error
- func StoreSendJob(jobContents string) error
- func StoreStatsJob(jobContents string) error
- func VerifyEmailAllowed(email string, flags int64) bool
- type EmailDoc
- type StatDoc
- type StatsJob
Constants ¶
View Source
const ( DB = "postmaster" EmailsColl = "emails" // stats is a reserved collection in mongo StatsColl = "records" )
Names of databases and collections in mongo
View Source
const ( Sent int = 1 << iota Delivered SpamReported Bounced Dropped Opened )
Variables ¶
View Source
var (
UniqueArgID = "stats_id"
)
Functions ¶
func GenerateEmailID ¶
func MarkAsBounced ¶
func MarkAsDelivered ¶
func MarkAsDelivered(id string)
func MarkAsDropped ¶
func MarkAsOpened ¶
func MarkAsOpened(id string)
func MarkAsSpamReported ¶
func MarkAsSpamReported(id string)
func RandomizeColls ¶
func RandomizeColls()
this is ONLY exported so webhook_test can use it todo: we should find a way around exporting this
func StoreEmailBounce ¶
func StoreEmailFlags ¶
func StoreEmailSpam ¶
func StoreSendJob ¶
func StoreStatsJob ¶
func VerifyEmailAllowed ¶
Types ¶
type StatDoc ¶
type StatsJob ¶
type StatsJob struct {
Email string `json:"email" validate:"email,nonzero"` //Email address of the intended recipient
Timestamp int64 `json:"timestamp,omitempty"`
Type string `json:"event" validate:"nonzero"` //One of: bounce, deferred, delivered, dropped, processed
StatsID string `json:"stats_id" validate:"nonzero"` //json key must match db.UniqueArgID
Reason string `json:"reason,omitempty" validate:"max=1024"`
}
Click to show internal directories.
Click to hide internal directories.