repositorypackage
0.0.0-20250130151220-2bd861f76655
Repository: https://github.com/komron-dev/bank.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# README
Ongoing pet project about bank (not completed)
A simple banking service that offers APIs to support:
- Creating and managing bank accounts, each including the account holder’s name, balance, and currency type.
- Logging all balance updates for every account, ensuring that each deposit or withdrawal generates a new record.
- Facilitating money transfers between two accounts, using transactions to ensure that both accounts are updated successfully or, if an issue occurs, no changes are made.
Setup local development
Install tools
- Docker Desktop
- PopSQL - free for users with Github Student Developer Pack
- Golang
MacOS
brew install golang-migrate
Windows Using scoop
scoop install migrate
Linux (*.deb package)
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add -
echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/(lsb_release -sc) main" > /etc/apt/sources.list.d/migrate.list
apt-get update
apt-get install -y migrate
Setup infrastructure
-
Create the bank-network for Docker
make network
-
Start postgres container in Docker:
make postgres
-
Create simplebank database:
make create_db
-
Run db migration:
make up_migrate
-
Run db migration up 1 version:
make up_migrate_last
-
Run db migration down all versions:
make down_migrate
-
Run db migration down 1 version:
make down_migrate_last
-
Generate SQL CRUD with sqlc:
make sqlc
-
Generate DB mock with gomock:
make mock
-
Create a new db migration:
make new_migration name=<migration_name>
How to run
-
Run the program:
make run
-
Run test:
make test