2

background

In the process of using the Golang language to develop "multiple" services, I have done a lot of CURD business, and I stopped and thought about it and found:

  1. out of demand
  2. Create a table as needed
  3. Define the grpc field through the table, that is, define proto.
  4. proto generates the pb.go file.
  5. Port layer outbound interface definition, in json format.

It is to extract the mysql field, and then generate go结构体 , proto message , so I wonder if I can make a tool to solve this problem.

The author is a chicken, so I use golang to engage in curd la~

So, I just want to have a tool that can define create table sql and automatically create proto files and json structures.

pigeon

I did what I said, but after stumbling and stumbling for more than a year, pigeons and pigeons, it finally came out.

Looking at last year's submission, it takes so long to do such a simple thing~

project address

Visit http://tools.itjsz.com

use

SQL

  • Generate Go struct through SQL, Proto

Here we pass in the Wordpress library's wp_user table.

It is not supported to generate create table SQL from other types of data.

Yaml

  • Generate data in other formats through yaml
Here is an example of yaml created by deploy k8s

Toml

  • Convert data into other formats through Toml

Projects often use Toml as the configuration file. Here we pass Toml text

other types

Others include json , xml , proto format, so we will not demonstrate them one by one, and the usage methods are similar.

At last

The product has been launched, and you are welcome to experience it. If you encounter any problems in use, or have any suggestions, please let me know through the following company number.

qrcode


小白要生发
1k 声望1.2k 粉丝

GoPHPer工程师