Documentation
¶
Index ¶
- type BudgetSummary
- type DB
- func (db *DB) AllPaymentTypes() ([]*PaymentType, error)
- func (db *DB) AllPayments() ([]*Payment, error)
- func (db *DB) GetBudgetSummary() (*BudgetSummary, error)
- func (db *DB) GetMonthlySummary() ([]*MonthlySummary, error)
- func (db *DB) GetPaymentSummary() ([]*PaymentSummary, error)
- func (db *DB) GetPaymentTypeById(i int) (*PaymentType, error)
- func (db *DB) GetRecentHouseHistory() ([]*MonthlySummary, error)
- func (db *DB) InsertPayment(p *Payment) error
- type Datastore
- type MonthlySummary
- type Payment
- type PaymentSummary
- type PaymentType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BudgetSummary ¶
type BudgetSummary struct {
RentPaid bool `json:"rentpaid"`
// Limit = RentAmount + TotalLocked
Limit float32 `json:"limit"`
TotalLocked float32 `json:"totallocked"`
LockedThisMonth float32 `json:"lockedthismonth"`
Totals []*PaymentSummary `json:"totals"`
}
Parent holder object for all payment summary details This provides the high level details for overview
type DB ¶ added in v1.1.1
func (*DB) AllPaymentTypes ¶ added in v1.1.1
func (db *DB) AllPaymentTypes() ([]*PaymentType, error)
Returns a slice of all PaymentTypes in DB:
func (*DB) AllPayments ¶ added in v1.1.1
Return all Payments from DB:
func (*DB) GetBudgetSummary ¶ added in v1.1.1
func (db *DB) GetBudgetSummary() (*BudgetSummary, error)
func (*DB) GetMonthlySummary ¶ added in v1.1.1
func (db *DB) GetMonthlySummary() ([]*MonthlySummary, error)
Aggregate the payment amounts based upon our pay boundary:
func (*DB) GetPaymentSummary ¶ added in v1.1.1
func (db *DB) GetPaymentSummary() ([]*PaymentSummary, error)
Aggregate the total payment amount for each payment_type:
func (*DB) GetPaymentTypeById ¶ added in v1.1.1
func (db *DB) GetPaymentTypeById(i int) (*PaymentType, error)
Returns only the specific PaymentType based on id:
func (*DB) GetRecentHouseHistory ¶ added in v1.1.1
func (db *DB) GetRecentHouseHistory() ([]*MonthlySummary, error)
Get our last 6 month recent house history figures:
func (*DB) InsertPayment ¶ added in v1.1.1
Insert pointer to payment into the DB It's also this function's responsibility to add the date:
type Datastore ¶ added in v1.1.1
type Datastore interface {
AllPayments() ([]*Payment, error)
AllPaymentTypes() ([]*PaymentType, error)
GetPaymentTypeById(i int) (*PaymentType, error)
InsertPayment(p *Payment) error
GetMonthlySummary() ([]*MonthlySummary, error)
GetBudgetSummary() (*BudgetSummary, error)
GetPaymentSummary() ([]*PaymentSummary, error)
GetRecentHouseHistory() ([]*MonthlySummary, error)
}
type MonthlySummary ¶
type MonthlySummary struct {
PaymentTypeId int `json:"payment_type_id"`
PaymentDate time.Time `json:"payment_date"`
Amount float32 `json:"amount"`
}
Total amount paid per date, per payment_type_id:
type Payment ¶
type Payment struct {
Id int `json:"id"`
PaymentTypeId int `json:"payment_type_id"`
PaymentDate time.Time `json:"payment_date"`
Amount float32 `json:"amount"`
}
An individual payment record, maps directly to the payment schema in DB
func (*Payment) GetPaymentDateString ¶
Getter and Setter for time.Time object:
type PaymentSummary ¶
type PaymentSummary struct {
PaymentTypeId int `json:"payment_type_id"`
Amount float32 `json:"amount"`
}
Total amount paid per PaymentType bucket: