sbhackerspace / sbhx-boardinator

SBHX Board Coordinator/Task Management System
2 stars 0 forks source link

Create EmailStatus type #19

Open elimisteve opened 10 years ago

elimisteve commented 10 years ago

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.

elimisteve commented 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
    ...
}
elimisteve commented 10 years ago

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.

elimisteve commented 10 years ago

Another good iota example: http://golang.org/doc/effective_go.html#constants