Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn committed Oct 30, 2024
1 parent db97a6d commit a788925
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 37 deletions.
6 changes: 3 additions & 3 deletions docs/3-开发工具/0-工具安装-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ go env GOOS
go env GOARCH
```

下载地址: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
下载地址: [releases](https://github.com/gogf/gf/releases)

### 通过 `go install` 安装

Expand All @@ -38,13 +38,13 @@ go install github.com/gogf/gf/cmd/gf/[email protected] # 指定版本(版本需要 >= v2

#### v2版本

预编译二进制下载: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf/releases)

源码:[gf/cmd/gf](https://github.com/gogf/gf/tree/master/cmd/gf)

#### v1版本

预编译二进制下载: [Releases · gogf/gf-cli (github.com)](https://github.com/gogf/gf-cli/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf-cli/releases)

源码: [gogf/gf-cli](https://github.com/gogf/gf-cli)

Expand Down
11 changes: 2 additions & 9 deletions docs/3-开发工具/1-版本查看-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,11 @@ hide_title: true

用以查看当前 `gf` 命令行工具编译时的版本信息。

| 栏目 | 说明 |
| --- | --- |
| 首行 | 工具的版本号 |
| Env Detail | 环境信息:<br />go的版本号<br />当前项目对于goframe的依赖情况 |
| CLI Detail / CLI Built Detail | 工具的详细信息:<br />安装目录<br />构建时的go版本<br />构建时的gf版本<br />预编译的构建信息更加详细 |
| Others Detail | 其他详细信息:<br />文档地址<br />当前系统时间 |

## 使用示例

### `>= v2.5.7`

```bash
```html
$ gf version
v2.7.2
Welcome to GoFrame!
Expand All @@ -44,7 +37,7 @@ Others Detail:

### `< v2.5.6`

```bash
```html
$ gf version
GoFrame CLI Tool v2.0.0, https://goframe.org
GoFrame Version: v2.0.0-beta.0.20211214160159-19c9f0a48845 in current go.mod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type SaveReq struct {

使用类型别名即可。

源码地址: [gf/example/httpserver/response-with-json-array at master · gogf/gf (github.com)](https://github.com/gogf/gf/tree/master/example/httpserver/response-with-json-array)
源码地址: [gf/example/httpserver/response-with-json-array](https://github.com/gogf/gf/tree/master/example/httpserver/response-with-json-array)

结果示例:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ hide_title: true

`GoFrame``Server` 默认自带的 `OpenAPI` 接口文档UI是 `redoc` 开源组件,该组件不支持页面 `Try It Out` 功能的。很多同学都在问,能否使用 `SwaggerUI` 页面来展示 `OpenAPI` 接口文档?有的企业内部并不支持连接外网的部分资源,那么能否将内部的接口文档UI替换为内部可访问的资源呢?

了解 `OpenAPI` 这个东东的小伙伴应该都知道, `OpenAPI` 只是通用的接口定义规范,而展示的接口文档UI是可以随便替换的,并且这种UI界面以及平台还特别多!使用 `GoFrame Server` 来切换接口文档UI页面,或者将接口文档对接到第三方接口文档平台 - **非常简单!详见示例: [gf/example/httpserver/swagger-set-template/main.go at master · gogf/gf (github.com)](https://github.com/gogf/gf/blob/master/example/httpserver/swagger-set-template/main.go)**
了解 `OpenAPI` 这个东东的小伙伴应该都知道, `OpenAPI` 只是通用的接口定义规范,而展示的接口文档UI是可以随便替换的,
并且这种UI界面以及平台还特别多!使用 `GoFrame Server` 来切换接口文档UI页面,
或者将接口文档对接到第三方接口文档平台 - **非常简单!详见示例:
[gf/example/httpserver/swagger-set-template/main.go](https://github.com/gogf/gf/blob/master/example/httpserver/swagger-set-template/main.go)**

## 使用示例

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ go env GOARCH

#### 版本在v2.0+

预编译二进制下载: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf/releases)

源码:[gf/cmd/gf](https://github.com/gogf/gf/tree/master/cmd/gf)

#### 版本在v2.0-

预编译二进制下载: [Releases · gogf/gf-cli (github.com)](https://github.com/gogf/gf-cli/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf-cli/releases)

源码: [gogf/gf-cli](https://github.com/gogf/gf-cli)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ go env GOOS
go env GOARCH
```

下载地址: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
下载地址: [releases](https://github.com/gogf/gf/releases)

### 通过 `go install` 安装

Expand All @@ -38,13 +38,13 @@ go install github.com/gogf/gf/cmd/gf/[email protected] # 指定版本(版本需要 >= v2

#### v2版本

预编译二进制下载: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf/releases)

源码:[gf/cmd/gf](https://github.com/gogf/gf/tree/master/cmd/gf)

#### v1版本

预编译二进制下载: [Releases · gogf/gf-cli (github.com)](https://github.com/gogf/gf-cli/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf-cli/releases)

源码: [gogf/gf-cli](https://github.com/gogf/gf-cli)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ go env GOOS
go env GOARCH
```

下载地址: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
下载地址: [releases](https://github.com/gogf/gf/releases)

### 通过 `go install` 安装

Expand All @@ -38,13 +38,13 @@ go install github.com/gogf/gf/cmd/gf/[email protected] # 指定版本(版本需要 >= v2

#### v2版本

预编译二进制下载: [Releases · gogf/gf (github.com)](https://github.com/gogf/gf/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf/releases)

源码:[gf/cmd/gf](https://github.com/gogf/gf/tree/master/cmd/gf)

#### v1版本

预编译二进制下载: [Releases · gogf/gf-cli (github.com)](https://github.com/gogf/gf-cli/releases)
预编译二进制下载: [releases](https://github.com/gogf/gf-cli/releases)

源码: [gogf/gf-cli](https://github.com/gogf/gf-cli)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ hide_title: true
2. `RightJoin` 右关联查询;
3. `InnerJoin` 内关联查询;

其实我们并不推荐使用 `Join` 进行联表查询,特别是在数据量比较大、并发请求量比较高的场景中,容易产生性能问题,也容易提高维护的复杂度。建议您在确定有此必要的场景下使用。此外,您也可以参考 [ORM链式操作-模型关联](output/goframe-v2.6-md/核心组件/数据库ORM/ORM链式操作/ORM链式操作-模型关联.md) 章节,数据库只负责存储数据和简单的单表操作,通过 `ORM` 提供的功能在代码层面实现数据聚合。
其实我们并不推荐使用 `Join` 进行联表查询,特别是在数据量比较大、并发请求量比较高的场景中,容易产生性能问题,也容易提高维护的复杂度。建议您在确定有此必要的场景下使用。
此外,您也可以参考 [模型关联](../4-ORM%E9%93%BE%E5%BC%8F%E6%93%8D%E4%BD%9C-%E6%A8%A1%E5%9E%8B%E5%85%B3%E8%81%94/0-%E6%A8%A1%E5%9E%8B%E5%85%B3%E8%81%94-%E5%8A%A8%E6%80%81%E5%85%B3%E8%81%94-ScanList.md) 章节,数据库只负责存储数据和简单的单表操作,通过 `ORM` 提供的功能在代码层面实现数据聚合。

使用示例:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dryRun = "(可选)ORM空跑(只读不写)"

这行配置一定要删掉或者设置为0

否则出现 `update insert` 操作不生效的现象。具体请参考文档: [ORM高级特性](output/goframe-v2.6-md/核心组件/数据库ORM/ORM高级特性.md)
否则出现 `update insert` 操作不生效的现象。

## `cannot find database driver for specified database type "xxx", did you misspell type name "xxx" or forget importing the database driver?`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type SaveReq struct {

使用类型别名即可。

源码地址: [gf/example/httpserver/response-with-json-array at master · gogf/gf (github.com)](https://github.com/gogf/gf/tree/master/example/httpserver/response-with-json-array)
源码地址: [gf/example/httpserver/response-with-json-array](https://github.com/gogf/gf/tree/master/example/httpserver/response-with-json-array)

结果示例:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hide_title: true

日志相关配置属性如下:

```
```go
Logger *glog.Logger // Logger for server.
LogPath string // Directory for storing logging files.
LogStdout bool // Printing logging content to stdout.
Expand Down Expand Up @@ -103,7 +103,7 @@ Stack:
开发者可以自定义处理 `Server` 的请求日志,方法有两种:

1. 可以通过日志配置项传递自定义的 `*glog.Logger` 对象。
2. 可以通过中间件来统一捕获处理,参考 [路由管理-中间件/拦截器](output/goframe-v2.6-md/WEB服务开发/路由管理/路由管理-中间件拦截器.md) 章节。
2. 可以通过中间件来统一捕获处理,参考 **中间件/拦截器** 章节。

## `Server` 日志与业务日志

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ sidebar_position: 4
hide_title: true
---

允许接口跨域往往是需要结合 [路由管理-中间件/拦截器](output/goframe-v2.6-md/WEB服务开发/路由管理/路由管理-中间件拦截器.md) 一起使用,来统一设置某些路由规则下的接口可以跨域访问。同时,针对允许 `WebSocket` 的跨域请求访问,也是通过该方式来实现。
允许接口跨域往往是需要结合 **中间件/拦截器** 一起使用,来统一设置某些路由规则下的接口可以跨域访问。
同时,针对允许 `WebSocket` 的跨域请求访问,也是通过该方式来实现。

相关方法: [https://pkg.go.dev/github.com/gogf/gf/v2/net/ghttp#Response](https://pkg.go.dev/github.com/gogf/gf/v2/net/ghttp#Response)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ priority service
### 示例5,允许跨域请求
在 [路由管理-中间件/拦截器](output/goframe-v2.6-md/WEB服务开发/路由管理/路由管理-中间件拦截器.md) 和 [CORS跨域处理](4-CORS跨域处理.md) 章节也有介绍跨域处理的示例,大多数情况下,我们使用中间件来处理跨域请求的实现居多。
`HOOK` 和中间件都能实现跨域请求处理,我们这里使用HOOK来实现简单的跨域处理。 首先我们来看一个简单的接口示例:
```go
Expand Down

0 comments on commit a788925

Please sign in to comment.