httpres

package
v0.0.0-...-f0a4171 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(c *gin.Context, err error)

func ErrorWithData

func ErrorWithData(c *gin.Context, err error, data interface{})

func GetBody

func GetBody(body io.ReadCloser, obj any) ([]byte, error)

func Request

func Request(method, uri string, header map[string]string, body []byte, obj any) ([]byte, error)

func Respone

func Respone(c *gin.Context, err error, data interface{})

func Success

func Success(c *gin.Context, data interface{})

Types

type PageInfo

type PageInfo struct {
	Page  int
	Size  int
	Total int64
}

func GetPageInfo

func GetPageInfo(c *gin.Context) PageInfo

func (PageInfo) Data

func (s PageInfo) Data(items any) gin.H

func (PageInfo) Offset

func (s PageInfo) Offset() int

func (PageInfo) Pages

func (s PageInfo) Pages() int

type ResponseData

type ResponseData struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

func GetResponeData

func GetResponeData(body io.ReadCloser) *ResponseData

func NewResponseData

func NewResponseData(code int, err error, data interface{}) *ResponseData

func NewSuccess

func NewSuccess() *ResponseData

func (*ResponseData) String

func (res *ResponseData) String() string

Jump to

Keyboard shortcuts

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