usecase

package
v0.0.0-...-341372b Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleDrive

type GoogleDrive interface {
	CreateFile(ctx context.Context, r io.Reader, filename string, ctype string, parentID string) (string, error)
}

GoogleDrive is a interface that interact with google drive.

type ImportMoneyForwardRecords

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

ImportMoneyForwardRecords is a usecase for money forward records.

func NewImportMoneyForwardRecords

func NewImportMoneyForwardRecords(reader MoneyForwardCSVReader, transaction Transaction, masterRepo MasterRepository, mfRepo MoneyForwardRepository) *ImportMoneyForwardRecords

NewImportMoneyForwardRecords returns a new ImportMoneyForwardRecords usecase.

func (*ImportMoneyForwardRecords) Execute

Execute executes the usecase.

type MasterRepository

type MasterRepository interface {
	FindOrCreateSource(ctx context.Context, name string) (*domain.Source, error)
	FindOrCreateCategory(ctx context.Context, name string, level domain.CategoryLevel, parentID string) (*domain.Category, error)
	FindCategoryByID(ctx context.Context, id string) (*domain.Category, error)
}

MasterRepository is a interface of MasterRepository.

type MoneyForward

type MoneyForward interface {
	Login(ctx context.Context) error
	DownloadCSV(ctx context.Context, year int, month time.Month) (io.ReadCloser, error)
}

MoneyForward is a interface tha interact with MoneyForward ME.

type MoneyForwardCSVReader

type MoneyForwardCSVReader interface {
	Read() ([]string, error)
	ReadAll() ([][]string, error)
}

MoneyForwardCSVReader is a interface that reads CSV data.

type MoneyForwardRepository

type MoneyForwardRepository interface {
	CreateOrUpdateRecord(ctx context.Context, record *domain.MoneyForwardRecord) error
}

MoneyForwardRepository is a interface of MoneyForwardRepository.

type StatsMoneyForwardRecords

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

StatsMoneyForwardRecords is a usecase for money forward records.

func NewStatsMoneyForwardRecords

func NewStatsMoneyForwardRecords(transaction Transaction, statsRepo StatsRepository, masterRepo MasterRepository, w io.Writer) *StatsMoneyForwardRecords

NewStatsMoneyForwardRecords returns a new StatsMoneyForwardRecords usecase.

func (*StatsMoneyForwardRecords) Execute

Execute executes the usecase.

type StatsMoneyForwardRecordsArgs

type StatsMoneyForwardRecordsArgs struct {
	Year int
}

StatsMoneyForwardRecordsArgs holds arguments to execute StatsMoneyForwardRecords.

type StatsRepository

type StatsRepository interface {
	FindExpensesByMonthInYear(ctx context.Context, year int) ([]*domain.AmountByYearMonth, error)
	FindExpensesByMonthAndCategoryInYear(ctx context.Context, year int) ([]*domain.AmountByYearMonthCategory, error)
}

StatsRepository is a interface of StatsRepository.

type Transaction

type Transaction interface {
	Begin(ctx context.Context) error
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
}

Transaction is a interface that executes a database transaction.

Jump to

Keyboard shortcuts

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