Documentation
¶
Index ¶
- type Account
- func (s *Account) Delete(a *model.Account) error
- func (s *Account) GetAll() []*model.Account
- func (s *Account) GetByID(id int64) *model.Account
- func (s *Account) GetByName(name string) *model.Account
- func (s *Account) Init(currencyService *Currency) error
- func (s *Account) Insert(a *model.Account) error
- func (s *Account) Update(a *model.Account) error
- type Category
- func (s *Category) Delete(c *model.Category) error
- func (s *Category) GetAll() []*model.Category
- func (s *Category) GetByID(id int64) *model.Category
- func (s *Category) GetByTitle(title string) *model.Category
- func (s *Category) Init() error
- func (s *Category) Insert(c *model.Category) error
- func (s *Category) Update(c *model.Category) error
- type Currency
- func (s *Currency) Delete(c *model.Currency) error
- func (s *Currency) GetAll() []*model.Currency
- func (s *Currency) GetByAbbreviation(abbreviation string) *model.Currency
- func (s *Currency) GetByID(id int64) *model.Currency
- func (s *Currency) Init() error
- func (s *Currency) Insert(c *model.Currency) error
- func (s *Currency) Update(c *model.Currency) error
- type Service
- type Transaction
- func (s *Transaction) Delete(t *model.Transaction) error
- func (s *Transaction) GetAll() []*model.Transaction
- func (s *Transaction) GetByID(id int64) *model.Transaction
- func (s *Transaction) Init(categoryService *Category, accountService *Account) error
- func (s *Transaction) Insert(t *model.Transaction) error
- func (s *Transaction) Update(t *model.Transaction) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account service contains business logic related to model.Account.
func NewAccount ¶
func NewAccount( persistentStorage *sqlite.Account, inmemoryStorage *inmemory.Account, currencyService *Currency) (*Account, error)
NewAccount returns Account service.
func (*Account) Init ¶
Init initialize inmemory storage with data from persistent storage. It is also links existing currencies to corresponding fields of model.Account.
type Category ¶
type Category struct {
// contains filtered or unexported fields
}
Category service contains business logic related to model.Category.
func NewCategory ¶
func NewCategory(persistentStorage *sqlite.Category, inmemoryStorage *inmemory.Category) (*Category, error)
NewCategory returns Category service.
func (*Category) GetByTitle ¶
GetByTitle returns category by given model.Category.Title.
type Currency ¶
type Currency struct {
// contains filtered or unexported fields
}
Currency service contains business logic related to model.Currency.
func NewCurrency ¶
func NewCurrency(persistentStorage *sqlite.Currency, inmemoryStorage *inmemory.Currency) (*Currency, error)
NewCurrency returns Currency service.
func (*Currency) GetByAbbreviation ¶
GetByAbbreviation returns currency by given model.Currency.Abbreviation.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a facade structure which aggregates all Services. It is used for convenience.
func New ¶
func New(ps *sqlite.SqliteStorage, is *inmemory.InmemoryStorage) (s *Service, err error)
New returns new Service.
func (*Service) Transaction ¶
func (s *Service) Transaction() *Transaction
Transaction returns transaction service.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction service contains business logic related to model.Transaction.
func NewTransaction ¶
func NewTransaction( persistentStorage *sqlite.Transaction, inmemoryStorage *inmemory.Transaction, categoryService *Category, accountService *Account) (*Transaction, error)
NewCurrency returns Transaction service.
func (*Transaction) Delete ¶
func (s *Transaction) Delete(t *model.Transaction) error
Delete deletes transaction from inmemory and persistent storages.
func (*Transaction) GetAll ¶
func (s *Transaction) GetAll() []*model.Transaction
GetAll returns all transactions.
func (*Transaction) GetByID ¶
func (s *Transaction) GetByID(id int64) *model.Transaction
GetByID returns transaction by given model.Transaction.ID.
func (*Transaction) Init ¶
func (s *Transaction) Init(categoryService *Category, accountService *Account) error
Init initialize inmemory storage with data from persistent storage. It is also links existing categories and accounts to corresponding fields of model.Transaction.
func (*Transaction) Insert ¶
func (s *Transaction) Insert(t *model.Transaction) error
Insert appends transaction to both persistent and inmemory storages.
func (*Transaction) Update ¶
func (s *Transaction) Update(t *model.Transaction) error
Update updates transaction in persistent and inmemory storages.