Go Gen Tools Save Abandoned

A Go code generator for grpc

Project README

Thanks for visiting my repository

Go Gen Tools

CI Go Report Card GitHub release (latest SemVer) GitHub go.mod Go version GitHub

A curated list of Go Gen Tools READMEs

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors License Badge

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Features
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

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.

(back to top)

Built With

This section list any major frameworks/libraries used to bootstrap project.

  • Go
  • AWS
  • Firebase
  • Nginx
  • MongoDB
  • Redis
  • Postgres
  • Kubernetes
  • ElasticSearch
  • Swagger

(back to top)

Getting Started

Prerequisites

Prerequisites 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-sql

Generate proto:

make gen-proto

Generate constract:

make gen-contract

Generate layer by DDD (delivery, service, repository):

make gen-layer

Generate mock:

make gen-mock

(back to top)

Features:

  • Auto generate protobuf files.
  • Auto generate mock interface for DDD.
  • Auto generate all layer of DDD.
  • Auto generate sql query with struct mapping and entities.
  • Auto migrate for Postgres.
  • Support generate repository layer for postgres, mongo, inmem.
  • Support mono repo architecture.
  • Auto generate cli with cobra-cli.
  • Support graceful shutdown.
  • Start kubernetes with Kind.
  • Manage kubernetes with Helm.
  • Support vscode settings.
  • Support github workflows.
  • Support Twilio client.
  • Support Sendgrid client.
  • Support AWS client.
  • Support metrics with Prometheus.
  • Support Grafana for monitor.
  • Support Elasticsearch client.
  • Support Ethereum client.
  • Support Kafka, Nats for message queue.
  • Support Redis client.
  • Support rate limit.
  • Support configuration for grpc client, grpc server, http client, http server.
  • Support Hystrix config for circuit breaker.
  • Support Consul client for load balancer.
  • Support open tracing with Jeager tracing.

(back to top)

Project Structure:

.
├── 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
│   │   └── 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

(back to top)

Architechture:

clean architecture

Installation:

Make sure you have Go installed (download). Version 1.19 or higher is required.

Install make for start the server.

For Linux:

sudo apt install make

For Macos:

brew install make

How to start server:

First of all, you must start postgres:

make start-postgres

After that should migrate:

make migrate

Start server with cmd/terminal:

make run

Start 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!

Open Source Agenda is not affiliated with "Go Gen Tools" Project. README Source: duyledat197/go-gen-tools

Open Source Agenda Badge

Open Source Agenda Rating