Skip to content

Commit 9e1682f

Browse files
committed
update docs
1 parent 6421490 commit 9e1682f

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed

.github/RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
- Add generate grpc+http service code
44
- Add generate service+handler CRUD code
5+
- Fix known bugs

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,24 @@ Sponge is mainly based on `SQL` and `Protobuf` two ways to generate code, each w
4747

4848
### Microservice framework
4949

50-
Sponge is essentially a microservice framework that includes code generation capabilities. The microservice framework is shown in the following figure, 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.
50+
Sponge is also a microservices framework, the framework diagram is shown 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.
5151

5252
<p align="center">
5353
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
5454
</p>
5555

5656
<br>
5757

58+
Performance testing of http and grpc service code created by the microservices framework: 50 concurrent, 1 million total requests.
59+
60+
![http-server](https://raw.githubusercontent.com/zhufuyi/microservices_framework_benchmark/main/test/assets/http-server.png)
61+
62+
![grpc-server](https://raw.githubusercontent.com/zhufuyi/microservices_framework_benchmark/main/test/assets/grpc-server.png)
63+
64+
Click to view the [**test code**](https://github.com/zhufuyi/microservices_framework_benchmark).
65+
66+
<br>
67+
5868
### Key Features
5969

6070
- Web framework [gin](https://github.com/gin-gonic/gin)
@@ -83,7 +93,7 @@ Sponge is essentially a microservice framework that includes code generation cap
8393

8494
### Project Code Directory Structure
8595

86-
The project code directory structure created by sponge follows the [project-layout](https://github.com/golang-standards/project-layout) convention and is structured as follows:
96+
The project code directory structure created by sponge follows the [project-layout](https://github.com/golang-standards/project-layout) and is structured as follows. Supported repository types are `monolithic application single repository (monolith)`, `microservice multi-repository (multi-repo)`, `microservice single repository (mono-repo)`.
8797

8898
```bash
8999
.
@@ -120,7 +130,7 @@ The project code directory structure created by sponge follows the [project-layo
120130

121131
#### Installation sponge
122132

123-
sponge can be installed on Windows, macOS, Linux and Docker environments. Click here for [instructions on installing sponge](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md).
133+
Sponge can be installed on Windows, macOS, Linux and Docker environments. Click here for [instructions on installing sponge](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md).
124134

125135
#### Starting UI service
126136

@@ -144,7 +154,7 @@ Detailed instructions for operating, configuring, and deploying a project using
144154

145155
### Examples of use
146156

147-
#### Examples of creating a service using sponge
157+
#### Examples of create services
148158

149159
- [Create **web** service based on **sql** (including CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
150160
- [Create **grpc** service based on **sql** (including CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
@@ -153,7 +163,7 @@ Detailed instructions for operating, configuring, and deploying a project using
153163
- [Create **grpc gateway** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
154164
- [Create **grpc+http** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/a_micro-grpc-http-protobuf)
155165

156-
#### Examples of developing a complete project using sponge
166+
#### Examples of develop complete project
157167

158168
- [Simple community web backend service](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
159169
- [Simple community web service broken down into microservice](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)

assets/readme-cn.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
<br>
44

5-
[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``Gin和GRPC` 的强大的开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。从开发、测试、api文档到部署一站式项目开发,大幅提高了开发效率和降低了开发难度,实现"低代码方式"开发项目
5+
[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``Gin和GRPC` 的强大的开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。从开发、测试、api文档到部署一站式项目开发,大幅提高了开发效率和降低了开发难度,实现"低代码方式"进行开发项目
66

77
<br>
88

9-
如果开发只有CRUD api接口的web或微服务,不需要编写任何go代码就可以编译并部署到linux服务器、docker、k8s上,只需要连接到数据库(mysql、mongodb、postgresql、tidb、sqlite)就可以一键自动生成完整的后端服务go代码。
9+
如果开发只有CRUD api的web或微服务,不需要编写任何go代码就可以编译并部署到linux服务器、docker、k8s上,只需要连接到数据库(mysql、mongodb、postgresql、tidb、sqlite)就可以一键自动生成完整的后端服务go代码。
1010

1111
如果开发通用的web或微服务,只需聚焦`在数据库定义表``在proto文件定义api描述信息``在生成的模板文件填写业务逻辑代码`三个核心部分,其他go代码都由sponge自动生成。
1212

1313
<br>
1414

1515
### 生成代码框架
1616

17-
sponge主要基于`SQL``Protobuf`两种方式生成代码,每种方式拥有生成不同用途的代码。其中`SQL`支持数据库**mysql****mongodb****postgresql****tidb****sqlite**
17+
sponge主要基于`SQL``Protobuf`两种方式生成代码,每种方式生成不同用途的代码。其中`SQL`支持数据库**mysql****mongodb****postgresql****tidb****sqlite**
1818

1919
#### 生成代码的框架图
2020

@@ -34,14 +34,24 @@ sponge主要基于`SQL`和`Protobuf`两种方式生成代码,每种方式拥
3434

3535
### 微服务框架
3636

37-
sponge本质是一个包含了自动生成代码功能的微服务框架,微服务框架如下图所示,这是典型的微服务分层结构,具有高性能,高扩展性,包含了常用的服务治理功能,可以很方便替换或添加自己的服务治理功能。
37+
sponge也是一个微服务框架,框架图如下图所示,这是典型的微服务分层结构,具有高性能,高扩展性,包含了常用的服务治理功能,可以很方便替换或添加自己的服务治理功能。
3838

3939
<p align="center">
4040
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
4141
</p>
4242

4343
<br>
4444

45+
创建的http和grpc服务代码的性能测试: 50个并发,总共100万个请求。
46+
47+
![http-server](https://raw.githubusercontent.com/zhufuyi/microservices_framework_benchmark/main/test/assets/http-server.png)
48+
49+
![grpc-server](https://raw.githubusercontent.com/zhufuyi/microservices_framework_benchmark/main/test/assets/grpc-server.png)
50+
51+
点击查看[**测试代码**](https://github.com/zhufuyi/microservices_framework_benchmark)
52+
53+
<br>
54+
4555
### 主要功能
4656

4757
sponge包含丰富的组件(按需使用):
@@ -53,7 +63,7 @@ sponge包含丰富的组件(按需使用):
5363
- 日志 [zap](https://github.com/uber-go/zap)
5464
- 数据库组件 [gorm](https://github.com/go-gorm/gorm), [mongo-go-driver](https://github.com/mongodb/mongo-go-driver)
5565
- 缓存组件 [go-redis](https://github.com/go-redis/redis), [ristretto](https://github.com/dgraph-io/ristretto)
56-
- 自动化api接口文档 [swagger](https://github.com/swaggo/swag), [protoc-gen-openapiv2](https://github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2)
66+
- 自动化api文档 [swagger](https://github.com/swaggo/swag), [protoc-gen-openapiv2](https://github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2)
5767
- 鉴权 [jwt](https://github.com/golang-jwt/jwt)
5868
- 校验 [validator](https://github.com/go-playground/validator)
5969
- 消息组件 [rabbitmq](https://github.com/rabbitmq/amqp091-go)
@@ -72,7 +82,7 @@ sponge包含丰富的组件(按需使用):
7282

7383
### 目录结构
7484

75-
生成的服务代码目录结构遵循 [project-layout](https://github.com/golang-standards/project-layout),代码目录结构如下所示
85+
生成的服务代码目录结构遵循 [project-layout](https://github.com/golang-standards/project-layout),代码目录结构如下所示。支持的仓库类型有`单体应用单体仓库(monolith)``微服务多仓库(multi-repo)``微服务单体仓库(mono-repo)`
7686

7787
```bash
7888
.

cmd/protoc-gen-go-rpc-tmpl/internal/generate/service/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ import (
263263
func Test_service_{{.LowerName}}_methods(t *testing.T) {
264264
conn := getRPCClientConnForTest()
265265
cli := serverNameExampleV1.New{{.Name}}Client(conn)
266-
ctx := context.Background()
266+
ctx, _ := context.WithTimeout(context.Background(), time.Second*30)
267267
268268
tests := []struct {
269269
name string

internal/server/http_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ func TestHTTPServerMock(t *testing.T) {
7777
addr := fmt.Sprintf(":%d", port)
7878

7979
o := defaultHTTPOptions()
80+
if o.isProd {
81+
gin.SetMode(gin.ReleaseMode)
82+
}
8083
s := &httpServer{
8184
addr: addr,
8285
instance: &registry.ServiceInstance{},
@@ -85,8 +88,6 @@ func TestHTTPServerMock(t *testing.T) {
8588
s.server = &http.Server{
8689
Addr: addr,
8790
Handler: http.NewServeMux(),
88-
ReadTimeout: o.readTimeout,
89-
WriteTimeout: o.writeTimeout,
9091
MaxHeaderBytes: 1 << 20,
9192
}
9293

0 commit comments

Comments
 (0)