Skip to content

Commit f552a77

Browse files
committed
update docs
1 parent c183ab4 commit f552a77

File tree

10 files changed

+52
-30
lines changed

10 files changed

+52
-30
lines changed

.github/RELEASE.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Change log
22

3-
- Support setting custom request id key name.
4-
- Add delayed queuing, publish-subscribe functionality to the pkg/rabbitmq library.
5-
- Add clustering, sentinel functionality to pkg/goredis.
6-
- Fix the discovered bugs.
3+
- Support for upgrading to specific versions.
4+
- Adjustment Authorization function.
75
- Update Documentation.

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,18 @@ Visit `http://localhost:24631` in your browser, generate code by manipulating it
9292

9393
### Examples of use
9494

95-
#### Simple examples (excluding business logic code)
95+
#### Simple examples
96+
97+
No specific business logic code is included.
9698

9799
- [1_web-gin-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
98-
- [2_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/2_web-gin-protobuf)
99-
- [3_micro-grpc-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/3_micro-grpc-CRUD)
100+
- [2_micro-grpc-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
101+
- [3_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
100102
- [4_micro-grpc-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
101103
- [5_micro-gin-rpc-gateway](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
102-
- [6_micro-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/6_micro-cluster)
104+
- [6_micro-cluster-demo](https://github.com/zhufuyi/sponge_examples/tree/main/6_micro-cluster)
103105

104-
#### Full project examples (including business logic code)
106+
#### Complete project examples
105107

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

assets/readme-cn.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ sponge生成代码过程中剥离了业务逻辑与非业务逻辑两大部分
4848
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/web-http-pb-anatomy.png">
4949
</p>
5050

51-
这是web服务代码鸡蛋模型,还有微服务(gRPC)代码、rpc网关服务代码的鸡蛋模型在[sponge文档](https://go-sponge.com/zh-cn/learn-about-sponge?id=%f0%9f%8f%b7%e9%a1%b9%e7%9b%ae%e4%bb%a3%e7%a0%81%e9%b8%a1%e8%9b%8b%e6%a8%a1%e5%9e%8b)中有介绍。
51+
这是web服务代码鸡蛋模型,还有微服务(grpc)代码、grpc网关服务代码的鸡蛋模型在[sponge文档](https://go-sponge.com/zh-cn/learn-about-sponge?id=%f0%9f%8f%b7%e9%a1%b9%e7%9b%ae%e4%bb%a3%e7%a0%81%e9%b8%a1%e8%9b%8b%e6%a8%a1%e5%9e%8b)中有介绍。
5252

5353
<br>
5454

@@ -99,9 +99,9 @@ sponge包含丰富的组件(按需使用):
9999
│ ├── handler # http的业务功能实现目录
100100
│ ├── model # 数据库模型目录
101101
│ ├── routers # http路由目录
102-
│ ├── rpcclient # 连接rpc服务的客户端目录
103-
│ ├── server # 服务入口,包括http、rpc等
104-
│ ├── service # rpc的业务功能实现目录
102+
│ ├── rpcclient # 连接grpc服务的客户端目录
103+
│ ├── server # 服务入口,包括http、grpc等
104+
│ ├── service # grpc的业务功能实现目录
105105
│ └── types # http的请求和响应类型目录
106106
├── pkg # 外部应用程序可以使用的库目录
107107
├── scripts # 用于执行各种构建、安装、分析等操作的脚本目录
@@ -137,18 +137,18 @@ sponge run
137137

138138
#### 简单示例
139139

140-
不包括业务逻辑代码
140+
不包含具体业务逻辑代码
141141

142142
- [1_web-gin-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
143-
- [2_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/2_web-gin-protobuf)
144-
- [3_micro-grpc-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/3_micro-grpc-CRUD)
143+
- [2_micro-grpc-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
144+
- [3_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
145145
- [4_micro-grpc-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
146146
- [5_micro-gin-rpc-gateway](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
147147
- [6_micro-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/6_micro-cluster)
148148

149149
#### 完整项目示例
150150

151-
包括业务逻辑代码
151+
包括具体业务逻辑代码
152152

153153
- [7_community-single](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
154154
- [8_community-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)
@@ -165,14 +165,13 @@ sponge run
165165
- [04 批量生成CRUD接口代码到web服务](https://www.bilibili.com/video/BV1AY411C7J7/)
166166
- [05 一键生成通用的web服务项目代码](https://www.bilibili.com/video/BV1CX4y1D7xj/)
167167
- [06 批量生成任意API接口代码到web服务](https://www.bilibili.com/video/BV1P54y1g7J9/)
168-
- [07 一键生成微服务(gRPC)完整项目代码](https://www.bilibili.com/video/BV1Tg4y1b79U/)
168+
- [07 一键生成微服务(grpc)完整项目代码](https://www.bilibili.com/video/BV1Tg4y1b79U/)
169169
- [08 批量生成CRUD代码到微服务项目代码](https://www.bilibili.com/video/BV1TY411z7rY/)
170-
- [09 一键生成通用的微服务(gRPC)项目代码](https://www.bilibili.com/video/BV1WY4y1X7zH/)
171-
- [10 批量生成rpc方法代码到微服务](https://www.bilibili.com/video/BV1Yo4y1q76o/)
172-
- [11 rpc测试神器,简单便捷](https://www.bilibili.com/video/BV1VT411z7oj/)
173-
- [12 一键生成rpc网关服务项目代码](https://www.bilibili.com/video/BV1mV4y1D7k9/)
170+
- [09 一键生成通用的微服务(grpc)项目代码](https://www.bilibili.com/video/BV1WY4y1X7zH/)
171+
- [10 批量生成grpc方法代码到微服务](https://www.bilibili.com/video/BV1Yo4y1q76o/)
172+
- [11 grpc测试神器,简单便捷](https://www.bilibili.com/video/BV1VT411z7oj/)
173+
- [12 一键生成grpc网关服务项目代码](https://www.bilibili.com/video/BV1mV4y1D7k9/)
174174
- [13 十分钟搭建一个微服务集群示例](https://www.bilibili.com/video/BV1YM4y127YK/)
175-
- [14 用chatGPT打造你的专属面试题库](https://www.bilibili.com/video/BV1V24y1w7wG/)
176175

177176
<br>
178177

cmd/protoc-gen-go-gin/internal/generate/service/template.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (c *{{.LowerServiceName}}Client) {{.MethodName}}(ctx context.Context, req *
6565
// example:
6666
// err := req.Validate()
6767
// if err != nil {
68-
// logger.Warn("req.Validate error", logger.Err(err), logger.Any("req", req), interceptor.ClientCtxRequestIDField(ctx))
68+
// logger.Warn("req.Validate error", logger.Err(err), logger.Any("req", req), interceptor.CtxRequestIDField(ctx))
6969
// return nil, ecode.StatusInvalidParams.Err()
7070
// }
7171
//
@@ -75,7 +75,7 @@ func (c *{{.LowerServiceName}}Client) {{.MethodName}}(ctx context.Context, req *
7575
{{- end}}
7676
// })
7777
// if err != nil {
78-
// logger.Warn("{{.MethodName}} error", logger.Err(err), interceptor.ClientCtxRequestIDField(ctx))
78+
// logger.Warn("{{.MethodName}} error", logger.Err(err), interceptor.CtxRequestIDField(ctx))
7979
// return nil, err
8080
// }
8181
//

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
@@ -89,8 +89,8 @@ func (s *{{.LowerServiceName}}) {{.MethodName}}(ctx context.Context, req *server
8989
// logger.Warn("req.Validate error", logger.Err(err), logger.Any("req", req), interceptor.ServerCtxRequestIDField(ctx))
9090
// return nil, ecode.StatusInvalidParams.Err()
9191
// }
92+
// ctx = interceptor.WrapServerCtx(ctx)
9293
//
93-
// ctx = context.WithValue(ctx, interceptor.ContextRequestIDKey, interceptor.ServerCtxRequestID(ctx))
9494
// reply, err := s.iDao.{{.MethodName}}(ctx, &model.{{.ServiceName}}{
9595
{{- range .RequestFields}}
9696
// {{.Name}}: req.{{.Name}},

cmd/sponge/commands/init.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
const latestVersion = "latest"
10+
911
// InitCommand initial sponge
1012
func InitCommand() *cobra.Command {
1113
cmd := &cobra.Command{
@@ -22,7 +24,7 @@ Examples:
2224
RunE: func(cmd *cobra.Command, args []string) error {
2325
fmt.Println("initialize sponge ......")
2426

25-
targetVersion := "latest"
27+
targetVersion := latestVersion
2628
// download sponge template code
2729
_, err := runUpgrade(targetVersion)
2830
if err != nil {

cmd/sponge/commands/upgrade.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Examples:
3535
RunE: func(cmd *cobra.Command, args []string) error {
3636
fmt.Println("upgrade sponge ......")
3737
if targetVersion == "" {
38-
targetVersion = "latest"
38+
targetVersion = latestVersion
3939
}
4040
ver, err := runUpgrade(targetVersion)
4141
if err != nil {
@@ -46,7 +46,7 @@ Examples:
4646
},
4747
}
4848

49-
cmd.Flags().StringVarP(&targetVersion, "version", "v", "latest", "upgrade sponge version")
49+
cmd.Flags().StringVarP(&targetVersion, "version", "v", latestVersion, "upgrade sponge version")
5050
return cmd
5151
}
5252

@@ -96,7 +96,7 @@ func copyToTempDir(targetVersion string) (string, error) {
9696
}
9797

9898
spongeDirName := ""
99-
if targetVersion == "latest" {
99+
if targetVersion == latestVersion {
100100
// find the new version of the sponge code directory
101101
arg := fmt.Sprintf("%s/pkg/mod/github.com/zhufuyi", gopath)
102102
result, err = gobash.Exec("ls", adaptPathDelimiter(arg))
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3'
2+
3+
services:
4+
rabbitmq:
5+
image: rabbitmq:3.12-management
6+
container_name: rabbitmq
7+
hostname: rabbitmq-service
8+
restart: always
9+
ports:
10+
- 5672:5672
11+
- 15672:15672
12+
volumes:
13+
- $PWD/data:/var/lib/rabbitmq
14+
- $PWD/plugins/enabled_plugins:/etc/rabbitmq/enabled_plugins
15+
- $PWD/plugins/rabbitmq_delayed_message_exchange-3.12.0.ez:/plugins/rabbitmq_delayed_message_exchange-3.12.0.ez
16+
environment:
17+
TZ: Asia/Shanghai
18+
RABBITMQ_DEFAULT_USER: guest
19+
RABBITMQ_DEFAULT_PASS: guest
20+
RABBITMQ_DEFAULT_VHOST: /
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[rabbitmq_delayed_message_exchange,rabbitmq_management,rabbitmq_prometheus].
Binary file not shown.

0 commit comments

Comments
 (0)