Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Uncategorized = &categories.Category{ Model: datastore.Model{UUID: uuid.NewV5(uuid.Nil, "Uncategorized")}, } Unaccounted = &categories.Category{ Model: datastore.Model{UUID: uuid.NewV5(uuid.Nil, "Unaccounted")}, } )
Service categories.
Functions ¶
This section is empty.
Types ¶
type CapitalService ¶
type CategoryService ¶ added in v0.2.0
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a service responsible for calculating spendings.
func NewService ¶
func NewService(capSrv CapitalService, transSrv TransactionsService, catSrv CategoryService) *Service
NewService initializes the spendings service.
type Spendings ¶ added in v0.2.0
type Spendings interface { AddAmount(cat *categories.Category, currency accounts.Currency, amount float64) AddAmounts(cat *categories.Category, amounts accounts.CurrencyAmounts) GetAmount(cat *categories.Category, currency accounts.Currency) float64 GetAmounts(cat *categories.Category) accounts.CurrencyAmounts GetUncategorized() accounts.CurrencyAmounts GetUnaccounted() accounts.CurrencyAmounts GetTotal() accounts.CurrencyAmounts AddTransaction(tx *transactions.Transaction) }
func NewSpendings ¶ added in v0.4.0
func NewSpendings(cats []*categories.Category) Spendings
NewSpendings initializes new spendings structure.
type TransactionsService ¶ added in v0.2.0
type TransactionsService interface {
GetUserTransactions(ctx context.Context, u *users.User, month string) (transactions.TransactionCollection, error)
}
Click to show internal directories.
Click to hide internal directories.