Setup Go Modules:
go mod init github.com/ShubhamTatvamasi/GoBackendApp
Setup GORM:
go get -u gorm.io/gorm
go get -u gorm.io/driver/postgres
Setup Postgres Database:
docker run -d -p 5432:5432 \
--name postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=simple_bank \
postgres:16-alpine
Connect to Postgres Database:
PGPASSWORD=postgres psql -h 0.0.0.0 -U postgres -d simple_bank
List active sessions:
SELECT * FROM pg_stat_activity;
Remove Postgres Database:
docker rm -f postgres