Skip to content

Commit ff5c7b4

Browse files
committed
update doc
1 parent eeb7345 commit ff5c7b4

15 files changed

+160
-246
lines changed

.github/RELEASE.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
## New
22

3-
- `⓷Create web service based protobuf` support batch add handler CRUDapi interface
3+
- `⓷Create web service based protobuf` support batch add handler CRUD api interface
44
- Add commands to generate mysql init and types.proto code.
55
- Modify the UI interface and adjust the menu to make the UI more clear and concise.
66
- Support web and standard rpc when generating protobuf.
77
- Modify the help information.
88
- Fix some known bugs.
9+
- Update Documentation.

README.md

+29-46
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414

1515
</div>
1616

17-
[sponge](https://github.com/zhufuyi/sponge) is a powerful tool for generating web and microservice code, a microservice framework based on gin and grpc encapsulation, and an open source framework for rapid application development. Sponge has a wealth of code generation commands, and different functional codes can be combined to form a complete service (similar to artificially scattered sponge cells that can automatically recombine into a new sponge). Microservice code functions include logging, service registration and discovery, registration center, flow control, fuse, link tracking, metric monitoring, pprof performance analysis, statistics, cache, CICD and other functions. Generate code unified in the UI interface operation, it is easy to build a complete project engineering code, allowing developers to focus on the implementation of the business logic code, without spending time and energy on the project configuration and integration.
17+
[sponge](https://github.com/zhufuyi/sponge) is a powerful golang productivity tool that integrates `automatic code generation`, `microservices framework`, `general basic development framework`. sponge has a wealth of code generation commands to generate different functionality of the code can be combined into a complete service (similar to artificially scattered sponge cells that can automatically recombine into a new sponge). Code decoupling modular design , it is easy to build a complete project from development to deployment, so that you develop web or microservices project easily, golang can also be "low-code development".
1818

1919
<br>
2020

2121
### sponge generates the code framework
2222

23-
The generated code is based on three approaches **Yaml**, **SQL** and **Protobuf**, each possessing different functional code generation, and the framework diagram of the generated code is shown in Figure 1-1.
23+
sponge is mainly based on **SQL** and **Protobuf** two ways to generate code, each way has to generate code for different functions.
24+
25+
**Generate code framework:**
2426

2527
<p align="center">
2628
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/sponge-framework.png">
@@ -29,61 +31,44 @@ The generated code is based on three approaches **Yaml**, **SQL** and **Protobuf
2931

3032
<br>
3133

32-
UI interface for generating code:
34+
**Generate code framework corresponding UI interface:**
3335

3436
<p align="center">
35-
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/en_sponge-ui.png">
37+
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/en_sponge-ui.png">
3638
</p>
3739

3840
<br>
3941

40-
### Components of the generated service code
41-
42-
The sponge separates the two major parts of code during the process of generating web service code. It isolates the business logic from the non-business logic. For example, consider the entire web service code as an egg. The eggshell represents the web service framework code, while both the albumen and yolk represent the business logic code. The yolk is the core of the business logic (manually written code). It includes defining MySQL tables, defining API interfaces, and writing specific logic code.On the other hand, the albumen acts as a bridge connecting the core business logic code to the web framework code (automatically generated, no manual writing needed). This includes the registration of route codes generated from proto files, handler method function codes, parameter validation codes, error codes, Swagger documentation, and more.
42+
### Services framework
4343

44-
The web service egg model dissection diagram is shown in the following figure:
44+
sponge generated microservice code framework is shown in the figure below, which is a typical microservice hierarchical structure, with high performance, high scalability, contains commonly used service governance features, you can easily replace or add their own service governance features.
4545

4646
<p align="center">
47-
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/en_web-http-pb-anatomy.png">
47+
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
4848
</p>
49+
<p align="center">Figure 1-2 Microservices framework diagram</p>
4950

5051
<br>
5152

52-
The gRPC service egg model dissection is shown in the following figure:
53-
54-
<p align="center">
55-
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/en_micro-rpc-pb-anatomy.png">
56-
</p>
53+
### Egg model for complete service code
5754

58-
<br>
55+
The sponge separates the two major parts of code during the process of generating web service code. It isolates the business logic from the non-business logic. For example, consider the entire web service code as an egg. The eggshell represents the web service framework code, while both the albumen and yolk represent the business logic code. The yolk is the core of the business logic (manually written code). It includes defining MySQL tables, defining API interfaces, and writing specific logic code.On the other hand, the albumen acts as a bridge connecting the core business logic code to the web framework code (automatically generated, no manual writing needed). This includes the registration of route codes generated from proto files, handler method function codes, parameter validation codes, error codes, Swagger documentation, and more.
5956

60-
The rpc gateway service egg model dissection is shown in the following figure:
57+
Egg model profiling diagram for `⓷Web services created based on protobuf`:
6158

6259
<p align="center">
63-
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/en_micro-rpc-gw-pb-anatomy.png">
60+
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/en_web-http-pb-anatomy.png">
6461
</p>
6562

66-
<br>
67-
68-
### Services framework
69-
70-
The microservice code framework created by sponge is shown in Figure 1-2, this is a typical microservice hierarchy with high performance, high scalability, and includes common service governance features.
71-
72-
<p align="center">
73-
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
74-
</p>
75-
<p align="center">Figure 1-2 Microservices framework diagram</p>
63+
This is the egg model for web service code, and there are egg models for microservice (gRPC) code, and rpc gateway service code described in [sponge documentation](https://go-sponge.com/).
7664

7765
<br>
7866

79-
### Installation
80-
81-
- [Install sponge in linux or macOS](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md#install-sponge-in-linux-or-macos)
82-
- [Install sponge in windows](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md#install-sponge-in-windows)
67+
### Quick start
8368

84-
<br>
69+
**Installation sponge:**
8570

86-
### Quick start
71+
sponge can be installed on Windows, macOS, and Linux environments. Click here to view [Installation Instructions](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md).
8772

8873
After installing the sponge, start the UI service:
8974

@@ -95,11 +80,15 @@ Visit `http://localhost:24631` in your browser, generate code by manipulating it
9580

9681
<br>
9782

98-
### Examples of use
83+
### Documentation
9984

100-
The following sample code , in addition to the core business logic code , the other code is generated by the tool sponge .
85+
[sponge documentation](https://go-sponge.com/)
10186

102-
#### Basic Services examples
87+
<br>
88+
89+
### Examples of use
90+
91+
#### Simple examples (excluding business logic code)
10392

10493
- [1_web-gin-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
10594
- [2_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/2_web-gin-protobuf)
@@ -108,19 +97,13 @@ The following sample code , in addition to the core business logic code , the ot
10897
- [5_micro-gin-rpc-gateway](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
10998
- [6_micro-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/6_micro-cluster)
11099

111-
#### Examples of a complete project
100+
#### Full project examples (including business logic code)
112101

113102
- [7_community-single](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
114103
- [8_community-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)
115104

116105
<br>
117106

118-
### Documentation
119-
120-
[sponge documentation](https://go-sponge.com/)
121-
122-
<br>
123-
124107
**If it's help to you, give it a star ⭐.**
125108

126109
<br>
@@ -138,7 +121,7 @@ You are more than welcome to join us, raise an Issue or Pull Request.
138121
Pull Request instructions.
139122

140123
1. Fork the code
141-
2. Create your own branch: git checkout -b feat/xxxx
142-
3. Commit your changes: git commit -am 'feat: add xxxxx'
143-
4. Push your branch: git push origin feat/xxxx
124+
2. Create your own branch: `git checkout -b feat/xxxx`
125+
3. Commit your changes: `git commit -am 'feat: add xxxxx'`
126+
4. Push your branch: `git push origin feat/xxxx`
144127
5. Commit your pull request

assets/en_sponge-ui.png

-18.6 KB
Loading

assets/install-cn.md

+41-73
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,112 @@
1-
### 在linux或macOS上安装sponge
1+
### 安装依赖
22

3-
#### (1) 安装go,要求1.16版本以上
3+
> 安装sponge之前需要先安装`go``protoc`两个依赖。
44
5-
下载go地址: [https://studygolang.com/dl](https://studygolang.com/dl)
5+
**✅ 安装 go**
66

7-
安装完后查看go版本
7+
下载go地址: [https://studygolang.com/dl](https://studygolang.com/dl)
88

9-
```bash
10-
go version
11-
```
9+
> 要求1.16以上版本,把`go install`命令编译生成的二进制文件所在目录(通常是$GOPATH/bin)添加到系统环境变量path。
1210
13-
注:把go install命令编译生成的二进制文件所在目录(通常是$GOPATH/bin)添加到系统目录下。
11+
查看go版本 `go version`
1412

1513
<br>
1614

17-
#### (2) 安装 protoc,要求v3.20以上版本
15+
**安装 protoc**
1816

1917
下载protoc地址: [https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3)
2018

21-
把 protoc 二进制文件添加到系统path下
19+
> 要求v3.20以上版本,把 protoc 二进制文件所在目录(建议是$GOPATH/bin)添加到系统环境变量path
2220
23-
安装完后查看protoc版本
21+
查看protoc版本: `protoc --version`
2422

25-
```bash
26-
protoc --version
27-
```
23+
<br>
24+
25+
安装完go和protoc之后,接下来安装sponge,支持在windows、mac、linux环境安装。
26+
27+
> 如果不能科学上网,安装sponge时,获取github的库会遇到超时失败问题,建议设置为国内代理,执行命令 **go env -w GOPROXY=https://goproxy.cn,direct**
2828
29+
<br>
2930
<br>
3031

31-
#### (3) 安装 sponge
32+
### 在linux或macOS上安装sponge
3233

3334
```bash
3435
# 安装sponge
3536
go install github.com/zhufuyi/sponge/cmd/sponge@latest
3637

37-
# 初始化sponge
38+
# 初始化sponge,自动安装sponge依赖插件
3839
sponge init
3940

40-
# 查看插件是否都安装成功,如果有安装不成功,执行命令重试 sponge tools --install
41+
# 查看插件是否都安装成功,如果发现有插件没有安装成功,执行命令重试 sponge tools --install
4142
sponge tools
4243

43-
# 安装完后查看sponge版本
44+
# 查看sponge版本
4445
sponge -v
4546
```
4647

47-
💡 如果想更新到最新版本,执行命令 `sponge upgrade`
48-
4948
<br>
5049
<br>
51-
<br>
52-
53-
### 在windows上安装sponge
5450

55-
#### (1) 安装go,要求1.16版本以上
51+
### **Windows环境**
5652

57-
下载go地址: [https://studygolang.com/dl](https://studygolang.com/dl)
53+
> 在windows环境中需要安装mingw64、make、cmder来支持linux命令环境才可以使用sponge。
5854
59-
安装完后查看go版本
55+
**✅ 安装 mingw64**
6056

61-
```bash
62-
go version
63-
```
57+
下载mingw64地址: [x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z)
6458

65-
注:把go install命令编译生成的二进制文件所在目录(通常是$GOPATH/bin)添加到系统目录下
59+
下载后解压到`D:\Program Files\mingw64`目录,把linux常用命令所在的目录`D:\Program Files\mingw64\bin`添加系统环境变量PATH
6660

6761
<br>
6862

69-
#### (2) 安装 protoc,v3.20以上版本
70-
71-
下载protoc地址: [https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3)
63+
**✅ 安装 make 命令**
7264

73-
把 protoc 二进制文件添加到系统path下
65+
切换到`D:\Program Files\mingw64\bin`目录,找到`mingw32-make.exe`可执行文件,复制并改名为`make.exe`
7466

75-
安装完后查看protoc版本
76-
77-
```bash
78-
protoc --version
79-
```
67+
查看make版本:`make -v`
8068

8169
<br>
8270

83-
#### (3) 在windows上安装支持linux命令环境
84-
85-
**安装 mingw64**
71+
**✅ 安装 cmder**
8672

87-
下载mingw64地址[https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z)
73+
下载cmder地址[cmder-v1.3.20.zip](https://github.com/cmderdev/cmder/releases/download/v1.3.20/cmder.zip)
8874

89-
下载后解压到`D:\Program Files\mingw64`目录下,修改系统环境变量PATH,新增`D:\Program Files\mingw64\bin`
75+
下载后解压到`D:\Program Files\cmder`目录下,并把目录`D:\Program Files\cmder`添加到系统环境变量path
9076

91-
<br>
77+
对cmder进行简单的配置:
9278

93-
**安装 make 命令**
79+
- **配置右键启动cmder**,按下组合键`win+x`,再按字母`a`进入有管理权限的终端,执行命令`Cmder.exe /REGISTER ALL`。 随便在一个文件夹里按下鼠标右键,选择`Cmder Here`即可打开cmder界面。
80+
- **解决输入命令时的空格问题**,打开cmder界面,按下组合键win+alt+p进入设置界面,在左上角搜索`Monospace`,取消勾选,保存退出。
9481

95-
切换到`D:\Program Files\mingw64\bin`目录,找到`mingw32-make.exe`可执行文件,复制并改名为`make.exe`
82+
> ⚠ 在windows环境使用sponge开发项目,为了避免找不到linux命令错误,请使用cmder,不要用系统自带的cmd终端、Goland和VS Code下的终端
9683
97-
安装完后查看版本
98-
99-
```bash
100-
make -v
101-
```
102-
103-
<br>
104-
105-
**安装 cmder**
106-
107-
下载cmder地址: [https://github.com/cmderdev/cmder/releases/download/v1.3.20/cmder.zip](https://github.com/cmderdev/cmder/releases/download/v1.3.20/cmder.zip)
108-
109-
下载后解压到`D:\Program Files\cmder`目录下,修改系统环境变量PATH,新增`D:\Program Files\cmder`
110-
111-
打开`Cmder.exe`终端,简单的设置cmder,点击右下角设置图标 --> 【settings】,在设置界面左上角输入`Monospace`查找,去掉勾选**Monospace**,然后保存关闭。
112-
113-
检查是否支持常用的linux命令。
84+
打开`cmder.exe`终端,检查是否支持常用的linux命令。
11485

11586
```bash
11687
ls --version
11788
make --version
11889
cp --version
11990
chmod --version
12091
rm --version
121-
go --version
12292
```
12393

12494
<br>
12595

126-
#### (4) 安装 sponge
96+
**安装 sponge**
12797

128-
打开`Cmder.exe`终端(不是windows自带的cmd),执行命令安装sponge:
98+
打开`cmder.exe`终端(不是windows自带的cmd),执行命令安装sponge:
12999

130100
```bash
131-
# 安装sponge,安装完后,sponge二进制文件所在目录添加到系统path
101+
# 安装sponge
132102
go install github.com/zhufuyi/sponge/cmd/sponge@latest
133103

134-
# 初始化sponge
104+
# 初始化sponge,自动安装sponge依赖插件
135105
sponge init
136106

137-
# 查看插件是否都安装成功,如果有安装不成功,执行命令重试 sponge tools --install
107+
# 查看插件是否都安装成功,如果发现有插件没有安装成功,执行命令重试 sponge tools --install
138108
sponge tools
139109

140-
# 安装完后查看sponge版本
110+
# 查看sponge版本
141111
sponge -v
142112
```
143-
144-
💡 如果想更新到最新版本,执行命令 `sponge upgrade`

0 commit comments

Comments
 (0)