lms

package
Version: v0.0.0-...-401f45e Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

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

View Source
var ErrClientAlreadyExists = errors.New("client_already_exists")

ErrClientAlreadyExists is an error returned when Client already exists

View Source
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

type ClientData struct {
	PersonalNumber      string
	FirstName, LastName string
}

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

Jump to

Keyboard shortcuts

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