-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* support map parse --------- Co-authored-by: gouhuan <[email protected]>
- Loading branch information
Showing
7 changed files
with
382 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,29 @@ Golang 1.16+ | |
go get -u github.com/zc2638/[email protected] | ||
``` | ||
|
||
## Use note: | ||
The time.time type uses jsonTag to parse it into a string type | ||
```go | ||
type XXX struct{ | ||
Now time.Time `json:",string"` | ||
} | ||
``` | ||
|
||
The compatibility is resolved as follows: | ||
```go | ||
type xxx struct { | ||
MapSlicePtr map[string][]*string | ||
MapSlice map[string][]string | ||
MapSliceStructPtr map[string][]*Person | ||
MapSliceStruct map[string][]Person | ||
SliceStructPtr *[]*Person | ||
SliceStruct *[]Person | ||
SliceStringPtr *[]*string | ||
SliceString *[]string | ||
} | ||
|
||
``` | ||
|
||
**Tip:** As of `v1.2.0`, lower versions are no longer compatible. In order to be compatible with most web frameworks, | ||
the overall architecture has been greatly changed. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,29 @@ Golang 1.16+ | |
go get -u github.com/zc2638/[email protected] | ||
``` | ||
|
||
## 使用注意: | ||
time.time类型使用jsonTag来将其解析为string类型 | ||
```go | ||
type XXX struct{ | ||
Now time.Time `json:",string"` | ||
} | ||
``` | ||
|
||
兼容的解析如下: | ||
```go | ||
type xxx struct { | ||
MapSlicePtr map[string][]*string | ||
MapSlice map[string][]string | ||
MapSliceStructPtr map[string][]*Person | ||
MapSliceStruct map[string][]Person | ||
SliceStructPtr *[]*Person | ||
SliceStruct *[]Person | ||
SliceStringPtr *[]*string | ||
SliceString *[]string | ||
} | ||
|
||
``` | ||
|
||
**Tip:** 从 `v1.2.0` 开始,低版本不再兼容。为了兼容大部分的web框架,整体架构做了很大的改动。 | ||
|
||
## 默认 Swagger UI 服务器 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.