Documentation
¶
Index ¶
- type Donation
- type DonationController
- func (d *DonationController) GetAll(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
- func (d *DonationController) GetTotal(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
- func (d *DonationController) GetTotalDonations(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
- func (d *DonationController) StartTotalUpdate(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (d *DonationController) StopTotalUpdate(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
- type DonationProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Donation ¶
type Donation struct { Amount float64 `json:"amount,omitempty"` Message string `json:"message,omitempty"` Name string `json:"name,omitempty"` Created time.Time `json:"created,omitempty"` User string `json:"user,omitempty"` }
Donation represents a single donation Non initialized fields will not be sent to the client
type DonationController ¶
type DonationController struct {
// contains filtered or unexported fields
}
DonationController represents the donation controller
func NewDonationController ¶
func NewDonationController(b *common.Controller, d DonationProvider, e bool) *DonationController
NewDonationController takes the base controller and a donation interface and returns a new DonationController
func (*DonationController) GetAll ¶
func (d *DonationController) GetAll(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
GetAll will return all donations
func (*DonationController) GetTotal ¶
func (d *DonationController) GetTotal(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
GetTotal will get the total amount of money donated
func (*DonationController) GetTotalDonations ¶
func (d *DonationController) GetTotalDonations(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
GetTotalDonations will return the number of all donations
func (*DonationController) StartTotalUpdate ¶
func (d *DonationController) StartTotalUpdate(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*DonationController) StopTotalUpdate ¶
func (d *DonationController) StopTotalUpdate(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
type DonationProvider ¶
type DonationProvider interface { // GetTotalAmount should return the total donation amount as a float64. It shouldn't be returned as cents GetTotalAmount() (float64, error) // GetTotalDonations should return the number of total donations GetTotalDonations() (int, error) // GetDonations should return all Donations GetDonations() ([]Donation, error) }
DonationProvider is the interface that has to be satisfied for something to work as a donation provider
Click to show internal directories.
Click to hide internal directories.