core

package
v0.0.0-...-571a155 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Debit is a transaction which is subtracted.
	Debit = 1

	// Credit is a transaction which is subtracted the next month.
	Credit = 2

	// Income is a transaction which is summed.
	Income = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Name string
}

Category is the general class of a Transaction (eg: Health, Food).

type CreateTransactionUseCase

type CreateTransactionUseCase struct {
	// contains filtered or unexported fields
}

CreateTransactionUseCase implements the business logic to create a transaction.

func NewCreateTransactionUseCase

func NewCreateTransactionUseCase(r Repository) *CreateTransactionUseCase

NewCreateTransactionUseCase initialize the use case.

func (*CreateTransactionUseCase) Create

Create a transaction.

type ListTransactionUseCase

type ListTransactionUseCase struct {
	// contains filtered or unexported fields
}

ListTransactionUseCase implements the business logic to find a transaction.

func NewListTransactionUseCase

func NewListTransactionUseCase(r Repository) *ListTransactionUseCase

NewListTransactionUseCase initialize the use case.

func (*ListTransactionUseCase) List

func (uc *ListTransactionUseCase) List() ([]Transaction, error)

List transaction(s).

type Repository

type Repository interface {
	Create(Transaction) (Transaction, error)
	Find() ([]Transaction, error)
}

Repository represents a client able to save and find a transaction.

type Transaction

type Transaction struct {
	ID       int
	Amount   int
	Type     int
	Category Category
	Date     time.Time
	Name     string
}

Transaction is money received or expended.

func (*Transaction) Validate

func (t *Transaction) Validate() error

Validate whether a transaction has all it's required properties set.

Jump to

Keyboard shortcuts

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