Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dapeng committed May 21, 2024
1 parent 0f80ce3 commit aa10243
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 28 deletions.
29 changes: 21 additions & 8 deletions docs/zh/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@ next: ../references/
# 开发指南

## [Gone的核心概念](./core-concept.md)
## [Gone支持哪些方式注入?](./goner-inject.md)
## [如何优雅使用内置Goners?](./use-inner-goner.md)
## [通过内置Goners支持配置文件](./config.md)
## [通过内置Goners支持数据库连接](./xorm.md)
## [Hook函数](./hooks.md)
## [日志输出](./logrus.md)
## [使用traceId追踪日志](./tracer.md)
## [自动生成Priest](./auto-gen-priest.md)

## 依赖注入
### [goner和依赖注入](./gone-and-inject)
### [Gone支持哪些方式注入?](./goner-inject.md)
### [对比 Gone 和 Spring 的依赖注入](./gone-vs-spring.md)

## 内置模块使用
### [如何优雅使用内置Goners?](./inner-goner.md)
### [通过内置Goners支持配置文件](./config.md)
### [日志输出](./logrus.md)
### [使用traceId追踪日志](./tracer.md)
### [通过内置Goners支持数据库连接](./xorm.md)
### [利用redis提供分布式锁和分布式缓存](./redis)
### [用cron表达式配置定时任务](./schedule)

## 效率提升

### [自动生成Priest](./auto-gen-priest.md)
### [Hook函数](./hooks.md)
### [错误处理](./error)
### [单元测试](./unit-test)
4 changes: 2 additions & 2 deletions docs/zh/guide/auto-gen-priest.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./tracer
next: ./redis
prev: ./schedule
next: ./hooks
---

# 自动生成Priest
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/config.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./inner-goner
next: ./xorm
next: ./logrus
---

# 通过内置Goners支持配置文件
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/error.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./schedule
next: false
prev: ./hooks
next: ./unit-test
---

# 错误处理
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/goner-inject.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar: auto
prev: ./core-concept
prev: ./gone-and-inject
next: ./gone-vs-spring
---

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/hooks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./xorm
next: ./logrus
prev: ./auto-gen-priest
next: ./error
---

# Gone的Hook函数
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/logrus.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar: auto
prev: ./hooks
prev: ./config
next: ./tracer
---

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/redis.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./auto-gen-priest
next: ./unit-test
prev: ./xorm
next: ./schedule
---

# 利用redis提供分布式锁和分布式缓存
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/schedule.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./unit-test
next: ./error
prev: ./redis
next: ./auto-gen-priest
---

# 用cron表达式配置定时任务
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/tracer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./logrus
next: ./auto-gen-priest
next: ./xorm
---

# 使用traceId追踪日志
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/unit-test.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./redis
next: ./schedule
prev: ./error
next: false
---

# 单元测试
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/xorm.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./config
next: ./hooks
prev: ./tracer
next: ./redis
---

# 通过内置Goners支持数据库操作
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/references/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ next: ../goners/

## [gone辅助工具](./gone-tool.md)

## [http 注入说明](./http-inject.md)
## [HTTP 注入说明](./http-inject.md)

## [Gone对Xorm的增强](./xorm.md)
50 changes: 49 additions & 1 deletion docs/zh/references/gone-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,53 @@ GLOBAL OPTIONS:
```
### 生成项目
**命令格式:**
```bash
gone create [-t ${template} [-m ${modName}]] ${appName}
```
**参数说明:**
- `-t`: 指定模板,默认为`web`,支持的模板类型如下:
- web:生成空白的web项目
- web+mysql:生成web项目,并集成mysql
- `-m`: 指定项目模块名称,默认为项目名
- `appName`: 指定项目名,默认为demo
例子可以参考[快速开始#Web 项目](https://goner.fun/zh/quick-start/web.html)
### 生成Priest函数
该命令的作用是扫描代码中的特殊注释`//go:gone`,生成一个**Priest**函数,将其标注的New函数生成的**Goner**埋葬到**Cemetery**中。
> 关于**Priest**函数、**Goner****Cemetery**的详细介绍,请参考[Gone的核心概念](https://goner.fun/zh/guide/core-concept.html)。
**命令格式:**
```bash
gone priest -s ${scanPackageDir} -p ${pkgName} -f ${funcName} -o ${outputFilePath} [-w] [--stat]
```
**参数说明:**
- `-s`: 指定扫描的包路径,不可缺省
- `-p`: 指定生成代码的包名,不可缺省
- `-f`: 指定生成Priest函数的名称,不可缺省
- `-o`: 指定生成Priest函数的输出文件路径,不可缺省
- `-w`: 监听文件变化,自动生成,默认为`false`
- `--stat`: 输出统计信息,默认为`false`
### 生成Priest函数
例子可以参考[自动生成Priest](https://goner.fun/zh/guide/auto-gen-priest.html)
### 生成Mock代码
该命令用于给工具**mockgen**生成的Mock代码进行处理,给mock结构体嵌入`gone.Flag`,使其mock生成的值为**Goner**
**命令格式:**
```bash
gone mock -f ${fromGoFile} -o ${outGoFile}
```
**参数说明:**
- `-f`: 指定要处理的go文件路径,不可缺省
- `-o`: 指定输出文件路径,不可缺省
支持管道符号,例如:
```bash
mockgen -package=gin -source=../cmux/interface.go -mock_names=Server=CmuxServer -|gone mock -o cumx_Server_mock_test.go
```
例子可以参考[单元测试](https://goner.fun/zh/guide/unit-test.html)

0 comments on commit aa10243

Please sign in to comment.