entity

package
v0.0.0-...-ca54044 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Entity
	Customer *Customer
	Balance  float64
}

func NewAccount

func NewAccount(customer *Customer) *Account

func (*Account) Deposit

func (e *Account) Deposit(amount float64) error

func (*Account) Withdraw

func (e *Account) Withdraw(amount float64) error

type Customer

type Customer struct {
	Entity
	Name  string
	Email string
}

func NewCustomer

func NewCustomer(name, email string) (*Customer, error)

func (*Customer) IsValid

func (e *Customer) IsValid() error

func (*Customer) Update

func (e *Customer) Update(name, email string) error

type Entity

type Entity struct {
	Id        string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Transaction

type Transaction struct {
	Entity
	To     *Account
	From   *Account
	Amount float64
}

func NewTransaction

func NewTransaction(to, from *Account, amount float64) (*Transaction, error)

func (*Transaction) Commit

func (e *Transaction) Commit()

func (*Transaction) IsValid

func (e *Transaction) IsValid() error

Jump to

Keyboard shortcuts

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