bank

package
v0.0.0-...-84d5eb4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientFunds = errors.New("cannot withdraw, insufficient funds")

ErrInsufficientFunds means wallet doesnot have enough funds

Functions

This section is empty.

Types

type Bitcoin

type Bitcoin int

Bitcoin represents the number of bit coins

func (Bitcoin) String

func (b Bitcoin) String() string

type Wallet

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

Wallet stroers the number of bitcoins someone owns

func (*Wallet) Balance

func (w *Wallet) Balance() Bitcoin

Balance returns current balance

func (*Wallet) Deposit

func (w *Wallet) Deposit(amount Bitcoin)

Deposit will add some bitcoin to current balance

func (*Wallet) Withdraw

func (w *Wallet) Withdraw(amount Bitcoin) error

Withdraw will withdraw some bitcoin to current balance

Jump to

Keyboard shortcuts

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