donations

package
v0.0.0-...-519d529 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

GetAll will return all donations

func (*DonationController) GetTotal

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL