Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/duyledat197/go-gen-tools
A Go code generator for grpc
https://github.com/duyledat197/go-gen-tools
architecture clean-architecture clean-code ddd ddd-architecture ddd-patterns generator go go-kit go-library golang golang-examples golang-tools grpc grpc-client grpc-go grpc-server protobuf protocol-buffers
Last synced: about 2 months ago
JSON representation
A Go code generator for grpc
- Host: GitHub
- URL: https://github.com/duyledat197/go-gen-tools
- Owner: duyledat197
- License: mit
- Archived: true
- Created: 2023-01-01T05:26:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-03T07:29:32.000Z (6 months ago)
- Last Synced: 2024-09-26T01:27:05.923Z (about 2 months ago)
- Topics: architecture, clean-architecture, clean-code, ddd, ddd-architecture, ddd-patterns, generator, go, go-kit, go-library, golang, golang-examples, golang-tools, grpc, grpc-client, grpc-go, grpc-server, protobuf, protocol-buffers
- Language: Go
- Homepage:
- Size: 555 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
This repository is no longer supported, so please don't use this template for production.
# Go Gen Tools
[![CI](https://github.com/idodod/protoc-gen-fieldmask/actions/workflows/ci.yml/badge.svg)](https://github.com/idodod/protoc-gen-fieldmask/actions/workflows/ci.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/idodod/protoc-gen-fieldmask)](https://goreportcard.com/report/github.com/idodod/protoc-gen-fieldmask)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/idodod/protoc-gen-fieldmask)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/idodod/protoc-gen-fieldmask)
![GitHub](https://img.shields.io/github/license/idodod/protoc-gen-fieldmask)A curated list of Go Gen Tools READMEs
Table of Contents
## About The Project
Go Gen Tools is a code generation tool that can automate repetitive tasks during application development. It provides a simple command-line interface that you can use to generate code files from templates or schema definitions.
### Built With
This section list any major frameworks/libraries used to bootstrap project.
* ![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge&logo=go&logoColor=white)
* ![AWS](https://img.shields.io/badge/AWS-%23FF9900.svg?style=for-the-badge&logo=amazon-aws&logoColor=white)
* ![Firebase](https://img.shields.io/badge/firebase-%23039BE5.svg?style=for-the-badge&logo=firebase)
* ![Nginx](https://img.shields.io/badge/nginx-%23009639.svg?style=for-the-badge&logo=nginx&logoColor=white)
* ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white)
* ![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white)
* ![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white)
* ![Kubernetes](https://img.shields.io/badge/kubernetes-%23326ce5.svg?style=for-the-badge&logo=kubernetes&logoColor=white)
* ![ElasticSearch](https://img.shields.io/badge/-ElasticSearch-005571?style=for-the-badge&logo=elasticsearch)
* ![Swagger](https://img.shields.io/badge/-Swagger-%23Clojure?style=for-the-badge&logo=swagger&logoColor=white)## Getting Started
### PrerequisitesPrerequisites
Before you start using Go Gen Tools, make sure that you have the following software installed on your computer:* Go programming language (version 1.20 or later)
* Git version control system
* A text editor or integrated development environment (IDE) for writing code
* Docker
* Kubernetes### Installation
To install Go Gen Tools, you need to run the following command in your terminal or command prompt:
```
go get github.com/duyledat197/[email protected]
```## Usage
Generate sql:
make gen-sqlGenerate proto:
make gen-protoGenerate constract:
make gen-contractGenerate layer by DDD (delivery, service, repository):
make gen-layerGenerate mock:
make gen-mock## Features:
- [x] Auto generate protobuf files.
- [x] Auto generate mock interface for DDD.
- [x] Auto generate all layer of DDD.
- [x] Auto generate sql query with struct mapping and entities.
- [x] Auto migrate for Postgres.
- [x] Support generate repository layer for postgres, mongo, inmem.
- [x] Support mono repo architecture.
- [x] Auto generate cli with [cobra-cli](https://github.com/spf13/cobra-cli).
- [x] Support graceful shutdown.
- [x] Start kubernetes with [Kind](https://kind.sigs.k8s.io/).
- [x] Manage kubernetes with [Helm](https://helm.sh/).
- [x] Support vscode settings.
- [x] Support github workflows.
- [ ] Support [Twilio](https://www.twilio.com/) client.
- [ ] Support [Sendgrid](https://sendgrid.com/) client.
- [ ] Support [AWS](https://aws.amazon.com/) client.
- [x] Support metrics with [Prometheus](https://prometheus.io/).
- [x] Support [Grafana](https://grafana.com/) for monitor.
- [x] Support [Elasticsearch](https://www.elastic.co/) client.
- [x] Support [Ethereum](https://ethereum.org/) client.
- [x] Support [Kafka](https://kafka.apache.org/), [Nats](https://nats.io/) for message queue.
- [x] Support [Redis](https://redis.io/) client.
- [x] Support rate limit.
- [x] Support configuration for grpc client, grpc server, http client, http server.
- [x] Support [Hystrix config](https://github.com/Netflix/Hystrix) for circuit breaker.
- [x] Support [Consul](https://www.consul.io/) client for load balancer.
- [x] Support open tracing with [Jeager tracing](https://www.jaegertracing.io/).## Project Structure:
```sh
.
├── LICENSE
├── Makefile
├── README.md
├── SECURITY.md
├── api
│ ├── contracts
│ │ └── store.sol
│ └── proto
│ ├── cobra
│ │ └── example.proto
│ ├── enum.proto
│ ├── hub.proto
│ ├── nats
│ │ ├── example.proto
│ │ ├── example_test.proto
│ │ └── nrpc.proto
│ ├── options
│ │ ├── annotations.pb.go
│ │ ├── annotations.proto
│ │ └── doc.go
│ ├── search.proto
│ ├── team.proto
│ └── user.proto
├── cmd
│ ├── cmd.go
│ ├── gateway.go
│ ├── inventory.go
│ ├── order.go
│ ├── root.go
│ ├── srv
│ │ └── main.go
│ ├── srv.go
│ └── thirdParty.go
├── config
│ └── config.go
├── database
│ ├── migrations
│ │ ├── 0001_migrate.up.sql
│ │ ├── 0002_migrate.up.sql
│ │ └── 0003_migrate.up.sql
│ └── queries
│ ├── hub.sql
│ ├── team.sql
│ └── user.sql
├── deployments
│ └── helms
│ ├── common.config.yaml
│ ├── configs
│ │ └── insfras.yaml
│ ├── gateway
│ │ ├── Chart.yaml
│ │ ├── charts
│ │ ├── templates
│ │ │ ├── NOTES.txt
│ │ │ ├── _helpers.tpl
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── hpa.yaml
│ │ │ ├── ingress.yaml
│ │ │ ├── secrets.yaml
│ │ │ ├── service.yaml
│ │ │ ├── serviceaccount.yaml
│ │ │ └── tests
│ │ │ └── test-connection.yaml
│ │ └── values.yaml
│ ├── inventory
│ │ ├── Chart.yaml
│ │ ├── charts
│ │ ├── templates
│ │ │ ├── NOTES.txt
│ │ │ ├── _helpers.tpl
│ │ │ ├── deployment.yaml
│ │ │ ├── hpa.yaml
│ │ │ ├── ingress.yaml
│ │ │ ├── service.yaml
│ │ │ ├── serviceaccount.yaml
│ │ │ └── tests
│ │ │ └── test-connection.yaml
│ │ └── values.yaml
│ ├── order
│ │ ├── Chart.yaml
│ │ ├── charts
│ │ ├── templates
│ │ │ ├── NOTES.txt
│ │ │ ├── _helpers.tpl
│ │ │ ├── deployment.yaml
│ │ │ ├── hpa.yaml
│ │ │ ├── ingress.yaml
│ │ │ ├── service.yaml
│ │ │ ├── serviceaccount.yaml
│ │ │ └── tests
│ │ │ └── test-connection.yaml
│ │ └── values.yaml
│ └── third_party
│ ├── Chart.yaml
│ ├── charts
│ ├── templates
│ │ ├── NOTES.txt
│ │ ├── _helpers.tpl
│ │ ├── deployment.yaml
│ │ ├── hpa.yaml
│ │ ├── ingress.yaml
│ │ ├── service.yaml
│ │ ├── serviceaccount.yaml
│ │ └── tests
│ │ └── test-connection.yaml
│ └── values.yaml
├── developments
│ ├── Dockerfile
│ ├── abi.Dockerfile
│ ├── bdd_test.Dockerfile
│ ├── docker-compose.yml
│ ├── gen-abi.sh
│ ├── gen-proto.sh
│ ├── proto.Dockerfile
│ ├── sqlc.yaml
│ └── start.sh
├── docs
│ ├── html
│ │ └── index.html
│ ├── markdown
│ │ └── docs.md
│ └── swagger
│ └── *.swagger.json
├── features
│ └── bdd.go
├── go.mod
├── go.sum
├── idl
│ ├── abi
│ │ ├── *.abi
│ │ └── *.go
│ └── pb
│ ├── cobra_pb
│ │ └── ...
│ ├── nats_pb
│ │ └── ...
│ └── ...
├── intergration_test.go
├── internal
│ ├── deliveries
│ │ ├── grpc
│ │ │ ├── hub.go
│ │ │ ├── search.go
│ │ │ ├── team.go
│ │ │ └── user.go
│ │ ├── http
│ │ └── ws
│ │ ├── client.go
│ │ ├── hub.go
│ │ └── ws.go
│ ├── models
│ │ ├── db.go
│ │ ├── hub.sql.go
│ │ ├── models.go
│ │ ├── querier.go
│ │ ├── team.sql.go
│ │ └── user.sql.go
│ ├── mongo
│ │ └── user.go
│ ├── repositories
│ │ ├── hub.go
│ │ ├── mongo
│ │ │ ├── hub.go
│ │ │ ├── team.go
│ │ │ └── user.go
│ │ ├── options.go
│ │ ├── postgres
│ │ │ ├── hub.go
│ │ │ ├── team.go
│ │ │ └── user.go
│ │ ├── team.go
│ │ └── user.go
│ └── services
│ ├── hub.go
│ ├── hub_test.go
│ ├── search.go
│ ├── team.go
│ └── user.go
├── pkg
│ ├── elastic_client
│ │ └── elastic.go
│ ├── eth_client
│ │ ├── balance.go
│ │ ├── client.go
│ │ ├── keystore.go
│ │ ├── transaction.go
│ │ └── wallet.go
│ ├── grpc_client
│ │ ├── grpc.go
│ │ └── option.go
│ ├── grpc_server
│ │ ├── grpc.go
│ │ ├── health_check.go
│ │ └── middleware.go
│ ├── http_server
│ │ ├── http.go
│ │ ├── middleware.go
│ │ └── middleware_test.go
│ ├── hystrix
│ │ └── config.go
│ ├── kafka
│ │ ├── consumer.go
│ │ ├── consumer_group.go
│ │ ├── producer.go
│ │ ├── producer_test.go
│ │ ├── publisher.go
│ │ └── subscriber.go
│ ├── mongo_client
│ │ └── mongo.go
│ ├── nrpc
│ │ ├── nrpc.go
│ │ └── nrpc.pb.go
│ ├── postgres_client
│ │ └── postgres.go
│ ├── prometheus_server
│ │ └── server.go
│ ├── pubsub
│ │ ├── model.go
│ │ ├── publisher.go
│ │ └── subscriber.go
│ ├── ratelimit
│ │ └── ratelimit.go
│ ├── redis_client
│ │ └── redis.go
│ ├── registry
│ │ ├── client.go
│ │ └── register.go
│ ├── swagger_server
│ │ └── server.go
│ └── tracing
│ └── client.go
├── third_party
│ ├── aws
│ │ ├── aws.go
│ │ └── s3.go
│ │ └── email.go
│ ├── marketing
│ │ └── marketing.go
│ └── sms
│ └── sms.go
├── tools
│ ├── gen-layer
│ │ ├── internal
│ │ │ ├── generator.go
│ │ │ └── step.go
│ │ ├── main.go
│ │ ├── models
│ │ │ ├── cli_step.go
│ │ │ ├── feature.go
│ │ │ └── template.go
│ │ ├── templates
│ │ │ ├── cucumber
│ │ │ │ ├── create.tpl
│ │ │ │ ├── delete.tpl
│ │ │ │ ├── list.tpl
│ │ │ │ ├── retrieve.tpl
│ │ │ │ └── update.tpl
│ │ │ ├── delivery
│ │ │ │ ├── create.tpl
│ │ │ │ ├── default.tpl
│ │ │ │ ├── delete.tpl
│ │ │ │ ├── list.tpl
│ │ │ │ ├── retrieve.tpl
│ │ │ │ └── update.tpl
│ │ │ ├── godog
│ │ │ │ ├── create.tpl
│ │ │ │ ├── default.tpl
│ │ │ │ ├── delete.tpl
│ │ │ │ ├── function.tpl
│ │ │ │ ├── list.tpl
│ │ │ │ ├── retrieve.tpl
│ │ │ │ └── update.tpl
│ │ │ ├── mongo
│ │ │ │ ├── create.tpl
│ │ │ │ ├── default.tpl
│ │ │ │ ├── delete.tpl
│ │ │ │ ├── list.tpl
│ │ │ │ ├── retrieve.tpl
│ │ │ │ └── update.tpl
│ │ │ ├── postgres
│ │ │ │ ├── create.tpl
│ │ │ │ ├── default.tpl
│ │ │ │ ├── delete.tpl
│ │ │ │ ├── list.tpl
│ │ │ │ ├── retrieve.tpl
│ │ │ │ └── update.tpl
│ │ │ ├── repository
│ │ │ │ └── default.tpl
│ │ │ └── service
│ │ │ ├── create.tpl
│ │ │ ├── default.tpl
│ │ │ ├── delete.tpl
│ │ │ ├── list.tpl
│ │ │ ├── retrieve.tpl
│ │ │ └── update.tpl
│ │ └── utils
│ │ ├── parser
│ │ │ └── parser.go
│ │ └── steps.go
│ ├── gen-service
│ ├── protoc-gen-custom
│ │ ├── internal
│ │ │ └── generator.go
│ │ └── main.go
│ └── protoc-gen-nrpc
│ ├── internal
│ │ └── genrator.go
│ ├── main.go
│ └── templates
│ └── nrpc.tpl
├── transform
│ └── ...
└── utils
├── authenticate
│ ├── authenticator.go
│ ├── jwt.go
│ ├── jwt_test.go
│ ├── paseto.go
│ ├── paseto_test.go
│ ├── payload.go
│ └── token.go
├── crypto
│ ├── sha256.go
│ └── sha256_test.go
├── helper
│ ├── validation.go
│ └── validation_test.go
├── ip.go
├── logger
│ └── zap.go
├── metadata
│ └── metadata.go
├── otp
│ ├── hotp.go
│ ├── otp.go
│ └── totp.go
├── pathutils
│ └── path.go
├── string.go
├── token.go
└── transformhelpers
└── helpers.go
```# Architechture:
![clean architecture](https://raw.githubusercontent.com/phungvandat/clean-architecture/dev/images/clean-arch.png)
## Installation:
Make sure you have Go installed ([download](https://golang.org/dl/)). Version `1.19` or higher is required.
Install make for start the server.
For Linux:
sudo apt install makeFor Macos:
brew install make## How to start server:
First of all, you must start postgres:
make start-postgresAfter that should migrate:
make migrateStart server with cmd/terminal:
make runStart server with docker:
make docker-start## Unit test:
Run all test:
make test## For using pprof:
###
install graphviz:```
$ go get -u github.com/google/pprof$ apt-get install graphviz gv // for linux/debian
$ brew install graphviz (mac) // for mac
```## License:
MIT
**Free Software, Hell Yeah!**