Open elimisteve opened 10 years ago
type EmailStatus struct {
Email *Email // Not sure which is better
EmailId string // Not sure which is better
Status SentStatus // This helps reduce type errors and will remind us to use pre-defined constants
...
}
What should SentStatus be? Ideas:
type SentStatus string // This is called a "type alias"
const (
QUEUED SentStatus = "queued"
SENDING SentStatus = "sending"
SUCCESS SentStatus = "success"
FAILED SentStatus = "failed"
)
Another idea:
type SentStatus uint // Another type alias, this time with the `int` type
const (
QUEUED SentStatus = iota
SENDING
SUCCESS
FAILED
)
See http://golang.org/ref/spec#Iota and the paragraph right before it.
Another good iota example: http://golang.org/doc/effective_go.html#constants
Should track the status of sending a particular email so we know which ones succeeded and which ones failed. Should include ForeignKey to the email whose status the given EmailStatus "object" is tracking.