response.go 514 B

1234567891011121314151617181920212223
  1. package response
  2. type JSONResult[T any] struct {
  3. Code int `json:"code"`
  4. Msg string `json:"message"`
  5. Data T `json:"data"`
  6. }
  7. type ListResponse[T any] struct {
  8. List []*T `json:"list"`
  9. }
  10. type PaginateResponse[T any] struct {
  11. List []*T `json:"list"`
  12. Total int `json:"total"`
  13. }
  14. type OffsetResponse[T any] struct {
  15. List []*T `json:"list"`
  16. Offset any `json:"offset"`
  17. }
  18. type OffsetTotalResponse[T any] struct {
  19. List []*T `json:"list"`
  20. Total int64 `json:"total"`
  21. Offset any `json:"offset"`
  22. }