file

package
v0.0.0-...-2a243e4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory string
const (
	PendingFolder Directory = "pending"
	ErrorFolder   Directory = "error"
	SuccessFolder Directory = "success"
)

type FinderService

type FinderService struct {
	PendingDirectory string
	SuccessDirectory string
	ErrorDirectory   string
}

func (*FinderService) GiveNextFileName

func (s *FinderService) GiveNextFileName() (string, error)

func (*FinderService) Relocate

func (s *FinderService) Relocate(filePath string, date time.Time, newFolder Directory)

type IFinder

type IFinder interface {
	// GiveNextFileName returns the name of the next csv file to process
	GiveNextFileName() (fileName string, err error)

	// Relocate changes csv file location
	Relocate(filePath string, date time.Time, newFolder Directory)
}

IFinder provides contracts related to find report files on filesystem

type IProcess

type IProcess interface {
	MakeSummary(transactions []domain.Transaction) domain.Summary
}

IProcess provides contracts related to process report files

type IReader

type IReader interface {
	ReadFile(fileName string) ([]domain.Transaction, []domain.IgnoredTransaction, error)
}

IReader contracts related to read report files

type ProcessService

type ProcessService struct{}

ProcessService provides implements IProcess with the challenge's business rules

func (*ProcessService) MakeSummary

func (s *ProcessService) MakeSummary(transactions []domain.Transaction) domain.Summary

type ReaderService

type ReaderService struct{}

ReaderService implements IReader reading for a csv file on current file system.

func (*ReaderService) ReadFile

func (s *ReaderService) ReadFile(fileName string) ([]domain.Transaction, []domain.IgnoredTransaction, error)

ReadFile reads a csv file of transactions and discriminates them by admitted or discarded

Jump to

Keyboard shortcuts

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