modulepackage
0.0.0-20250131185100-43332e7e8c80
Repository: https://github.com/devder/grpc-b.git
Documentation: pkg.go.dev
# README
API service
This service provide APIs for the frontend to do following things:
- Create and manage accounts, which are composed of owner’s name, balance, and currency.
- Record all balance changes to each of the account, so every time some money is added to or subtracted from the account, an account entry record will be created.
- Perform a money transfer between 2 accounts. This should happen within a transaction, so that either both accounts’ balance are updated successfully or none of them are.
Setup local environment
Install tools
-
brew install golang-migrate
-
npm install -g dbdocs dbdocs login
-
npm install -g @dbml/cli dbml2sql --version
-
brew install sqlc
-
go get github.com/golang/mock/[email protected]
Setup infra
-
Run db migration up all versions:
make migrateup
-
Run db migration up 1 version:
make migrateup1
-
Run db migration down all versions:
make migratedown
-
Run db migration down 1 version:
make migratedown1
How to generate code
-
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 server and db:
docker compose up
-
Run server:
make server
-
Run test:
make test
Deploy to Kubernetes cluster
-
Install nginx ingress controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.0-beta.0/deploy/static/provider/aws/deploy.yaml
-
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.4.0/cert-manager.yaml
# 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
Package pb is a reverse proxy.
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