Documentation ¶
Index ¶
- type Database
- func (m *Database) Close() error
- func (m *Database) CreateDomain(name string) error
- func (m *Database) CreateForward(name string, from string, to string) error
- func (m *Database) DeleteDomain(name string) error
- func (m *Database) DeleteForward(name string, from string) error
- func (m *Database) Domains() ([]*Domain, error)
- func (m *Database) UpdateForward(name string, from string, to string) error
- type Domain
- type Forward
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
Database holds the state of the persistant storage.
func NewDatabase ¶
NewDatabase creates a new persistant storage instance. connection holds the MySQL connection string, which is passed through to the database layer.
func (*Database) CreateDomain ¶
CreateDomain creates a new domain with the given name. If a domain with the same name exists, an error is returned.
func (*Database) CreateForward ¶
CreateForward created a new email forward for a domain. The domain is identified by its name. The forward is defined by the from email and to to email. If no domain with the given name exists, an error is returned. If a forward with the same from address already exists, an error is returned.
func (*Database) DeleteDomain ¶
DeleteDomain deletes an existing domain, specified by its name. All associated forwards of the domain will be deleted as well. If no domain with the given name exists, an error is returned.
func (*Database) DeleteForward ¶
DeleteForward deletes an existing forward for a domain. The domain is identified by its name. The forward is identified by the from email. If no domain with the given name exists, an error is returned.
func (*Database) Domains ¶
Domains returns a list of all domains, including the associated email forwards.
func (*Database) UpdateForward ¶
UpdateForward updates an existing forward for a domain. The domain is identified by its name. The forward is identified by the from email. Only the to email can be updated. If no domain with the given name exists, an error is returned. If no forward with the given from address exists, an error is returned.
type Domain ¶
Domain is the caller-facing replica of the internal database model. It contains the state of the room domain object, with reference to all email forwards.
type Forward ¶
Forward is the caller-facing replica of the internal database model. It contains the state of the leaf email forward object.
type Server ¶
Server holds the state of a HTTP server. The HTTP server exposes REST methods to manipulate domains and their associated (email) forwards.