Documentation ¶
Overview ¶
Package visa stores business layer of our application. As you can see, this package is not depend on any low-level details. All details are hidden behind four interfaces: - ApplicationStorage - VisasStorage - ReportsStorage - ReportsPrinter If you check out main `cmd/...` packages, you can see, how we inject low-level dependencies inside our Service implementation.
Index ¶
Constants ¶
const MaxTimeToStay = 24 * 90
MaxTimeToStay described maximum time in hours from arrival to departure.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
Application described Visa Application domain model.
type ApplicationStorage ¶
type ApplicationStorage interface {
GetVisaApplication(id int) (*Application, error)
}
ApplicationStorage described VISA applications persistent storage.
type MockApplicationStorage ¶
MockApplicationStorage is an autogenerated mock type for the ApplicationStorage type
func (*MockApplicationStorage) GetVisaApplication ¶
func (_m *MockApplicationStorage) GetVisaApplication(id int) (*Application, error)
GetVisaApplication provides a mock function with given fields: id
type MockReportsStorage ¶
MockReportsStorage is an autogenerated mock type for the ReportsStorage type
func (*MockReportsStorage) LoadApplicationReport ¶
func (_m *MockReportsStorage) LoadApplicationReport(id int) (*Report, error)
LoadApplicationReport provides a mock function with given fields: id
func (*MockReportsStorage) SaveApplicationReport ¶
func (_m *MockReportsStorage) SaveApplicationReport(_a0 Report) error
SaveApplicationReport provides a mock function with given fields: _a0
type MockVisasStorage ¶
MockVisasStorage is an autogenerated mock type for the VisasStorage type
func (*MockVisasStorage) GetPreviousVisas ¶
func (_m *MockVisasStorage) GetPreviousVisas(name string) ([]Visa, error)
GetPreviousVisas provides a mock function with given fields: name
type Report ¶
Report described Visa Application Report domain model. In other words this structure described Visa Application Result.
type ReportsPrinter ¶
ReportsPrinter implements reports printer. We use it as output port for printing application result.
type ReportsStorage ¶
type ReportsStorage interface { SaveApplicationReport(Report) error LoadApplicationReport(id int) (*Report, error) }
ReportsStorage describes VISA application reports persistent storage.
type Service ¶
type Service struct { AStore ApplicationStorage VStore VisasStorage RStore ReportsStorage PrintReport ReportsPrinter }
Service implements Visa Confirmation Service.
func (*Service) CheckConfirmation ¶
CheckConfirmation gets information about Visa confirmation byt applicationID. This method implement our Business Logic. Don't focus on business-logic itself. THE MAIN THING HERE IS THAT OUR METHOD DEPENDS ON INTERFACES, NOT LOW-LEVEL DETAILS.
type VisasStorage ¶
VisasStorage describes VISA persistent storage.