Documentation ¶
Overview ¶
Package db contains common entities (errors, models and etc). All DB implementations have to use them
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrYearNotExist = errors.New("there're no records for passed year") ErrMonthNotExist = errors.New("such Month doesn't exist") ErrDayNotExist = errors.New("such Day doesn't exist") ErrIncomeNotExist = errors.New("such Income doesn't exist") ErrMonthlyPaymentNotExist = errors.New("such Monthly Payment doesn't exist") ErrSpendNotExist = errors.New("such Spend doesn't exist") ErrSpendTypeNotExist = errors.New("such Spend Type doesn't exist") )
Common errors
Functions ¶
This section is empty.
Types ¶
type AddIncomeArgs ¶
type AddMonthlyPaymentArgs ¶
type AddSpendArgs ¶
type EditIncomeArgs ¶
type EditMonthlyPaymentArgs ¶
type EditSpendArgs ¶
type Income ¶
type Income struct { ID uint `json:"id"` Year int `json:"year"` Month time.Month `json:"month" swaggertype:"integer"` Title string `json:"title"` Notes string `json:"notes,omitempty"` Income money.Money `json:"income" swaggertype:"number"` }
Income contains information about incomes (salary, gifts and etc.)
type Month ¶
type Month struct { ID uint `json:"id"` Year int `json:"year"` Month time.Month `json:"month" swaggertype:"integer"` Incomes []*Income `json:"incomes"` MonthlyPayments []*MonthlyPayment `json:"monthly_payments"` // DailyBudget is a (TotalIncome - Cost of Monthly Payments) / Number of Days DailyBudget money.Money `json:"daily_budget" swaggertype:"number"` Days []*Day `json:"days"` TotalIncome money.Money `json:"total_income" swaggertype:"number"` // TotalSpend is a cost of all Monthly Payments and Spends TotalSpend money.Money `json:"total_spend" swaggertype:"number"` // Result is TotalIncome - TotalSpend Result money.Money `json:"result" swaggertype:"number"` }
type MonthlyPayment ¶
type MonthlyPayment struct { ID uint `json:"id"` Year int `json:"year"` Month time.Month `json:"month" swaggertype:"integer"` Title string `json:"title"` Type *SpendType `json:"type,omitempty"` Notes string `json:"notes,omitempty"` Cost money.Money `json:"cost" swaggertype:"number"` }
MonthlyPayment contains information about monthly payments (rent, Patreon and etc.)
type SearchOrder ¶ added in v0.2.0
type SearchOrder int
SearchOrder is used to specify order of search results. 'Asc' by default
const ( OrderByAsc SearchOrder = iota OrderByDesc )
type SearchSpendsArgs ¶ added in v0.2.0
type SearchSpendsArgs struct { Title string // Must be in lovercase Notes string // Must be in lovercase // TitleExactly defines should we search exactly for the given title TitleExactly bool // NotesExactly defines should we search exactly for the given notes NotesExactly bool After time.Time Before time.Time MinCost money.Money MaxCost money.Money // WithoutType is used to search for Spends without Spend Type. TypeIDs must be ignored when it is true WithoutType bool TypeIDs []uint Sort SearchSpendsColumn Order SearchOrder }
SearchSpendsArgs is used to search for spends. All fields are optional
nolint:maligned
type SearchSpendsColumn ¶ added in v0.2.0
type SearchSpendsColumn int
SearchSpendsColumn is used to specify column to sort by. 'Date' by default
const ( SortSpendsByDate SearchSpendsColumn = iota SortSpendsByTitle SortSpendsByCost )
type Spend ¶
type Spend struct { ID uint `json:"id"` Year int `json:"year"` Month time.Month `json:"month" swaggertype:"integer"` Day int `json:"day"` Title string `json:"title"` Type *SpendType `json:"type,omitempty"` Notes string `json:"notes,omitempty"` Cost money.Money `json:"cost" swaggertype:"number"` }
Spend contains information about spends
Directories ¶
Path | Synopsis |
---|---|
Package pg provides a PostgreSQL implementation for DB
|
Package pg provides a PostgreSQL implementation for DB |
Click to show internal directories.
Click to hide internal directories.