Go Gin Skeleton template includes all the common packages and setup used for API development using gin.
- Dependency Injection: fx
- Routing: gin web framework
- Logging: zap
- Database: (mysql / sqlmock)
- ORM: gorm
- API documentation: gin-swagger
- Middlewares
- CORS
- Rate Limit
- DB Transaction
- CLI tools
For Debugging 🐞 Debugger runs at 5002
. Vs code configuration is at .vscode/launch.json
which will attach
debugger to remote application.
- Copy
.env.example
to.env
and update according to requirement. -
- run
docker-compose up
(with default configuration will run at5000
and adminer runs at5001
)
- run
-
- run
make run
- run
Command | Desc |
---|---|
make install |
installs goalngci-lint and change the hooks config |
make run |
runs the project using gin watcher |
make migrate <options> |
runs migrate command with env configs from .env |
make crud |
Create crud template |
make swagger |
Run this command to generate swag docs |
make dao |
Generates go structs from database |
make context-upload |
Upload Context to Circle CI Directly |
Run
go get <package name>
to install.
- Package name: github.com/readytowork-org/go_firebase_service
- Github: https://github.com/readytowork-org/go_firebase_service
- Package name: github.com/readytowork-org/go_gcp_service
- Github: https://github.com/readytowork-org/go_gcp_service
Please refer to SWAGGER.md
- Run
docker-compose exec web sh
- After running type
./__debug_bin cli
you will start cli application. - Choose the commands to run afterwards.
- To run
docker-compose up
( with default configuration will run at 5000 and adminer runs at 5001) - To run with setting up pre-commit hook
make start
( with default configuration will run at 5000 and adminer runs at 5001`)
This reduces hassle for developer to update IP in Cloud SQL during IP Change.
Implemented through docker image as follows
- Cloud SQL -> Google Proxy Docker Image -> Web App
ServiceAccountKey.json
requires Cloud SQL Read and Write PermissionDB_HOST_NAME
value in.env
is requiredDB_HOST=cloud-sql-proxy
instead ofIPV4
orDB_HOST_NAME
for development environmentDB_PORT
will be3306
by default
For auto generate of CRUD(Create, ReaD, Update & Delete) api following informations are needed and will be asked in terminal:
-
resource-name: name of CRUD in upper camelCase. examples:Food,Puppy,ProductCategory etc.
-
resource-table-name: name of CRUD in lower snake case. examples:food,puppy,product_category etc.
-
plural-resource-table-name: plural name for the table going to be created. example: foods, puppies, product_categories.
-
plural-resource-name: plural name of CRUD in Upper camelCase. examples:Foods,Puppies,ProductCategories etc.