models

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2019 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

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

type DB struct {
	*sql.DB
}

func InitDB

func InitDB(dataSourceName string) (*DB, error)

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

func (db *DB) AllPayments() ([]*Payment, error)

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

func (db *DB) InsertPayment(p *Payment) error

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

func (p *Payment) GetPaymentDateString() string

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:

type PaymentType

type PaymentType struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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