Photo taken on Aug 1, 2021 shows Xixi in Hangzhou.

introduce

I recommend two useful tools for GO development.

Why recommend tools? It was to get the people in the comments section to introduce me to something better and free my hands.

By the way, is there a tool that can automatically type code just by talking?

JSON-To-Stuct

This tool converts JSON formatted data into GO structs. For example, when you connect to a third party, you don’t need to define struct fields according to their interface. The following example copies the wechat small store merchandise JSON data to the left box of the website, of course, they still need to do some local adjustments.

Goland 21 also supports this feature. That’s all you need in Goland,

Table-To-Stuct

Students who are busy with their business can’t avoid CURD every day. You had to build the table before CURD. You have to define the model in code after you build the table. You can’t define fields one by one, so the following tool might work.

Suppose you have a dream library with a table category that looks like this,

You simply introduced github.com/gohouse/converter, then write the code, can achieve the function table – to – go.

Running this code will generate a category. Go file based on the address set in SavePath (you need to create your own directory that doesn’t already exist).

Adjust accordingly.

conclusion

Today, I mainly share jSON-to-stuct and table-to-stuct, which are two tools that will be used in daily life.

Okay, now it’s time for you to introduce me to the right tools.

Recommended previous articles:

  • Thief on Leetcode is too hard!!

  • Leetcode:House Robber II

  • Infinite buffered channel(1)

  • Infinite buffered channel(2)

  • How to implement a worker-pool in GO?

  • Why migrate DIG to Wire