Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parameter.md #88

Open
wants to merge 1 commit into
base: feat/v3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/tutorials/api/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ type Foo {
Name string `json:"name" form:"name"`
}
```

go-zero 如果需要使用雪花算法,由于雪花算法长度问题,到前端可能丢失精度,此时前端需使用string,后端用int64,可以使用如下写法:

```go
type Foo {
Id int64 `json:"id,string"`
}
```
:::

## 参数校验规则
Expand All @@ -46,4 +54,4 @@ type Foo {
1. 左闭右开区间:[min:max),表示大于等于 min 小于 max,当 max 缺省时,max 代表数值 0,当 min 缺省时,min 代表无穷大,min 和 max 不能同时缺省
1. 闭区间:[min:max],表示大于等于 min 小于等于 max,当 min 缺省时,min 代表数值 0,当 max 缺省时,max 代表无穷大,min 和 max 不能同时缺省
1. 开区间:(min:max),表示大于 min 小于 max,当 min 缺省时,min 代表数值 0,当 max 缺省时,max 代表无穷大,min 和 max 不能同时缺省
:::
:::