Skip to content

Commit 0ff254e

Browse files
committed
feat: 优化代码
1 parent 1e64a19 commit 0ff254e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,20 @@ go get -u github.com/tiancheng92/gin_example_with_generic
2525
* 修改`./config_file/local.yaml`文件
2626

2727
```yaml
28-
Mysql:
29-
DBHost: "127.0.0.1" ## 数据库地址
30-
DBPort: "3306" ## 数据库端口
31-
DBName: "gin_example" ## 数据库名称
32-
DBUser: "root" ## 数据库用户名
33-
DBPassword: "" ## 数据库密码
28+
## 数据库链接DSN
29+
Mysql: "root:@tcp(127.0.0.1:3306)/gin_example?charset=utf8&parseTime=true&loc=Local"
3430

31+
## gin服务配置
3532
Server:
3633
Mode: "debug" ## 运行模式,test、debug或release
3734
ServicePort: "8080" ## 服务端口
3835
ServiceHost: "0.0.0.0" ## 服务器地址
3936

40-
Log:
41-
Level: "debug" ## 日志级别,debug、info、warn、error
37+
## 日志级别,debug、info、warn、error
38+
LogLevel: "debug"
4239

43-
I18n:
44-
Locale: "zh" ## 国际化,zh en ja
40+
## 国际化
41+
I18n: "zh" # zh en ja
4542
```
4643
4744
### 构建
@@ -273,7 +270,7 @@ type ReadOnlyControllerInterface[M ModelInterface] interface {
273270
### 参数校验
274271

275272
* gin_example_with_generic模型使用[validator](https://github.com/go-playground/validator)进行参数校验,并对其进行了二次分装。
276-
* 默认支持了中、英、日语言(仅需在配置文件的`I18n.Locale`字段中进行设置)
273+
* 默认支持了中、英、日语言(仅需在配置文件的`I18n`字段中进行设置)
277274
* 支持自定义翻译与自定义校验规则定义
278275
* Code:
279276
[pkg/validator/validator.go](https://github.com/tiancheng92/gin_example_with_generic/blob/main/pkg/validator/validator.go)

0 commit comments

Comments
 (0)