GoBankHub
Tools:
dbdiagram.io
Docker
Database Configuration
Database Schema

Postgres Docker
Documents of Postgres
Use the command to get a lightweight image, it is good enough for this mini-project.
docker pull postgres:16-alpine
Then start a postgres instance by:
docker run --name postgres16 -p 5432:5432 -e POSTGRES_USER=root_user -e POSTGRES_PASSWORD=123456 -d postgres:16-alpine
docker exec -it postgres16 psql -U root_user
DB migration in Go
brew install golang-migrate
migrate create -ext sql -dir db/migration -seq init_schema
I have created a Makefile for convenience, by runnnig command below(in the root directory) to run a contanier and create db:
make postgres
make createdb
then run the command to make a migration:
migrate -path db/migration -database "postgresql://root_user:123456@localhost:5432/gobankhub?sslmode=disable" -verbose up
go mod tidy to update the dependencies.
CI/CD
Postgres service container
Docs
RESTful Http Json API
Viper
Docs
Configur the environment files.
mockgen
mockgen -package mockdb -destination db/mock/store.go github.com/Mive667/GoBankHub/db/sqlc Store