schema.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package schema
  2. // HTTPStatusText 定义HTTP状态文本
  3. type HTTPStatusText string
  4. func (t HTTPStatusText) String() string {
  5. return string(t)
  6. }
  7. // HTTPError HTTP响应错误
  8. type HTTPError struct {
  9. Error HTTPErrorItem `json:"error"` // 错误项
  10. }
  11. // HTTPErrorItem HTTP响应错误项
  12. type HTTPErrorItem struct {
  13. Code int `json:"code"` // 错误码
  14. Message string `json:"message"` // 错误信息
  15. TraceId string `json:"trace_id"` // 追踪Id,用于快速定位错误
  16. }
  17. // HTTPStatus HTTP响应状态
  18. type HTTPStatus struct {
  19. Status string `json:"status"` // 状态(OK)
  20. }
  21. // HTTPList HTTP响应列表数据
  22. type HTTPList struct {
  23. List interface{} `json:"list"`
  24. Pagination *HTTPPagination `json:"pagination,omitempty"`
  25. }
  26. // HTTPPagination HTTP分页数据
  27. type HTTPPagination struct {
  28. Total int `json:"total"`
  29. Current int `json:"current"`
  30. PageSize int `json:"pageSize"`
  31. }
  32. // PaginationParam 分页查询条件
  33. type PaginationParam struct {
  34. PageIndex int // 页索引
  35. PageSize int // 页大小
  36. }
  37. // PaginationResult 分页查询结果
  38. type PaginationResult struct {
  39. Total int // 总数据条数
  40. }
  41. //VerifyToken 验证码令牌
  42. type VerifyToken struct {
  43. Token string `json:"token"` //令牌
  44. }