Documentation ¶
Overview ¶
Package lms (Loans Management System) is an entry API for all application logic. It provides methods for every use case. In DDD terminology its an application layer. It interacts with database using repository abstractions to load and persist client with their loans to disk. This makes the package independent of any technology used for storing data. The package should be used by servers (such as ReST HTTP server) or graphical user interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClientAlreadyExists = errors.New("client_already_exists")
ErrClientAlreadyExists is an error returned when Client already exists
var ErrClientDoesNotExist = errors.New("client_does_not_exist")
ErrClientDoesNotExist is an error return when Client does not exist
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { PersonalNumber() string FirstName() string LastName() string HasActiveLoan() bool }
Client is someone who wants to take a loan
type ClientData ¶
ClientData stores personal information about client and is used as data transfer object DTO
type Lms ¶
type Lms interface { RegisterClient(clientData ClientData) (Client, error) ClientByPersonalNumber(personalNumber string) (client Client, found bool, error error) ApplyForLoan(personalNumber string, amount uint, term uint) (error error) }
Lms provides methods for all use cases in the system
func NewFakeLms ¶
func NewFakeLms() Lms
NewFakeLms returns Lms fake implementation storing everything in memory which is useful for testing GUI and other clients (such as REST server)
Directories ¶
Path | Synopsis |
---|---|
domain
Package domain provides core business logic which is independent of any other systems and repositories
|
Package domain provides core business logic which is independent of any other systems and repositories |
infra/repo
Package repo provides lms.ClientRepo implementation which stores everything in memory
|
Package repo provides lms.ClientRepo implementation which stores everything in memory |