response

package
v0.0.0-...-28f24a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrResponse

type ErrResponse struct {
	Code    int    `json:"code" example:"400"` // 业务错误码
	Message string `json:"message"`            // 业务错误信息
}

type IResponse

type IResponse interface {
	Serialize(singleModel interface{}) interface{}
	Paginate(modelSlice interface{}) interface{}
}

type PageMeta

type PageMeta struct {
	Page    int `json:"page" example:"1"`      // 页码
	PerPage int `json:"per_page" example:"15"` // 每页数量
	Total   int `json:"total" example:"100"`   // 总数
}

type PageResponse

type PageResponse struct {
	Code int         `json:"code" example:"0"` // 业务状态码
	Data interface{} `json:"data"`             // 数据
	Meta PageMeta    `json:"meta"`             // 附加信息
}

type Response

type Response struct {
	Code int         `json:"code" example:"0"` // 业务状态码
	Data interface{} `json:"data"`             // 数据
}

type Serializer

type Serializer struct {
}
var RespSerializer *Serializer

func (*Serializer) Paginate

func (serializer *Serializer) Paginate(resp IResponse, modelSlice interface{}, page int, perPage int) *PageResponse

func (*Serializer) Serialize

func (serializer *Serializer) Serialize(resp IResponse, singleModel interface{}) *Response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL