Skip to content

Commit

Permalink
1、更新gin 请求响应共用字段注释
Browse files Browse the repository at this point in the history
  • Loading branch information
lshaofan committed Feb 25, 2023
1 parent 9c98305 commit b95761a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions application/dto/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ package request

// ListRequest 列表请求参数
type ListRequest struct {
Page int `form:"page" json:"page" query:"page" binding:"omitempty,min=1" msg:"页码最小为1" example:"1"`
PageSize int `form:"page_size" json:"page_size" query:"page_size" binding:"omitempty,min=1" msg:"每页数量最小为1" example:"10"`
Order string `form:"order" json:"order" query:"order" msg:"排序" example:"descend"`
Field string `form:"field" json:"field" query:"field" msg:"排序字段" example:"id"`
Page int `form:"page" json:"page" query:"page" binding:"omitempty,min=1" msg:"页码最小为1" `
PageSize int `form:"page_size" json:"page_size" query:"page_size" binding:"omitempty,min=1" msg:"每页数量最小为1" `
Order string `form:"order" json:"order" query:"order" msg:"排序" `
Field string `form:"field" json:"field" query:"field" msg:"排序字段" `
}

// ListResponse 列表响应参数
Expand Down
14 changes: 7 additions & 7 deletions application/dto/response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const (

// ErrorModel 错误模型
type ErrorModel struct {
Code int `json:"code" example:"-1"`
Message string `json:"message" example:"操作失败"`
Code int `json:"code" `
Message string `json:"message" `
Error interface{} `json:"result"`
HttpStatus int `json:"httpStatus" swaggerignore:"true"`
}
Expand All @@ -33,17 +33,17 @@ const (

// Response 返回数据
type Response struct {
Code int `json:"code" example:"0"`
Code int `json:"code" `
Result interface{} `json:"result"`
Message string `json:"message" example:"操作成功"`
Message string `json:"message" `
}

// PageList 分页数据
type PageList[T interface{}] struct {
Total int64 `json:"total" example:"100"`
Total int64 `json:"total" `
Data []T `json:"data" `
Page int `json:"page" example:"1"`
PageSize int `json:"page_size" example:"10"`
Page int `json:"page" `
PageSize int `json:"page_size" `
}

// NewError 创建错误
Expand Down

0 comments on commit b95761a

Please sign in to comment.