domain

package
v0.0.0-...-ff54fb6 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const WITHDRAWAL = "withdrawal"

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountId   string  `db:"account_id"`
	CustomerId  string  `db:"customer_id"`
	OpeningDate string  `db:"opening_date"`
	AccountType string  `db:"account_type"`
	Amount      float64 `db:"amount"`
	Status      string  `db:"status"`
}

func NewAccount

func NewAccount(customerId, accountType string, amount float64) Account

func (Account) CanWithdraw

func (a Account) CanWithdraw(amount float64) bool

func (*Account) ToResponseDto

func (a *Account) ToResponseDto() dto.NewAccountResponse

type AccountRepository

type AccountRepository interface {
	Save(Account) (*Account, *errs.AppError)
	SaveTransaction(transaction Transaction) (*Transaction, *errs.AppError)
	FindBy(accountId string) (*Account, *errs.AppError)
}

type AccountRepositoryMysql

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

func NewAccountRepositoryMysql

func NewAccountRepositoryMysql(dbClient *sqlx.DB) AccountRepositoryMysql

func (AccountRepositoryMysql) FindBy

func (db AccountRepositoryMysql) FindBy(accountId string) (*Account, *errs.AppError)

func (AccountRepositoryMysql) Save

func (AccountRepositoryMysql) SaveTransaction

func (db AccountRepositoryMysql) SaveTransaction(t Transaction) (*Transaction, *errs.AppError)

type Customer

type Customer struct {
	Id          string `db:"customer_id"`
	Name        string
	City        string
	Zipcode     string
	DateofBirth string `db:"date_of_birth"`
	Status      string
}

func (Customer) ToDto

func (c Customer) ToDto() dto.CustomerResponse

type CustomerRepository

type CustomerRepository interface {
	FindAll(status string) ([]Customer, *errs.AppError)
	ById(string) (*Customer, *errs.AppError)
}

type CustomerRepositoryMysql

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

func NewCustomerRepositoryMysql

func NewCustomerRepositoryMysql(dbClient *sqlx.DB) CustomerRepositoryMysql

func (CustomerRepositoryMysql) ById

func (CustomerRepositoryMysql) FindAll

func (db CustomerRepositoryMysql) FindAll(status string) ([]Customer, *errs.AppError)

type CustomerRepositoryStub

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

func NewCustomerRepositoryStub

func NewCustomerRepositoryStub() CustomerRepositoryStub

func (CustomerRepositoryStub) FindAll

func (s CustomerRepositoryStub) FindAll() ([]Customer, error)

type Transaction

type Transaction struct {
	TransactionId   string  `db:"transaction_id"`
	AccountId       string  `db:"account_id"`
	Amount          float64 `db:"amount"`
	TransactionType string  `db:"transaction_type"`
	TransactionDate string  `db:"transaction_date"`
}

func (Transaction) IsWithdrawal

func (t Transaction) IsWithdrawal() bool

func (*Transaction) ToResponseDto

func (t *Transaction) ToResponseDto() dto.TransactionResponse

type TransactionRepository

type TransactionRepository interface {
	Withdraw(Transaction) (*Transaction, *errs.AppError)
	Deposit(Transaction) (*Transaction, *errs.AppError)
}

Jump to

Keyboard shortcuts

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