http

package
v0.0.0-...-d6956c3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Ctx *gin.Context
}

type BasePage

type BasePage struct {
	Start uint32 `json:"start" form:"start,default=0"`
	Limit uint32 `json:"limit" form:"limit,default=15"`
	// contains filtered or unexported fields
}

func ParsePage

func ParsePage(page BasePage, opts ...Option) BasePage

type BaseResp

type BaseResp struct {
	HasMore bool        `json:"hasMore"`
	Start   uint32      `json:"start"`
	List    interface{} `json:"list"`
}

func BuildResponse

func BuildResponse(list interface{}, page BasePage) *BaseResp

type IResponse

type IResponse interface {
	Success(data interface{}, msg string)
	DefaultSuccess(data interface{})
	Bind(param interface{}, opts ...Option) error
	Error(err error)
}

func NewResponse

func NewResponse(gtx *gin.Context) IResponse

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithDefaultStart

func WithDefaultStart(defaultStart uint32) Option

func WithMaxLimit

func WithMaxLimit(maxLimit uint32) Option

type PaginationEntity

type PaginationEntity struct {
	// 是否有下一页
	HasMore bool `json:"more"`
	// 下一页开始数据
	Start int32 `json:"start"`
	// 数据列表
	List interface{} `json:"list"`
}

PaginationEntity 分页数据体

type Response

type Response struct {
	// contains filtered or unexported fields
}

func (*Response) Bind

func (r *Response) Bind(param interface{}, opts ...Option) error

func (*Response) DefaultSuccess

func (r *Response) DefaultSuccess(data interface{})

func (*Response) Error

func (r *Response) Error(err error)

响应错误

func (*Response) Success

func (r *Response) Success(data interface{}, msg string)

Success 响应成功请求

type ResponseEntity

type ResponseEntity struct {
	// 错误码
	ErrorCode int `json:"errcode"`
	// 响应消息
	Message string `json:"errmsg"`
	// 响应数据
	Data interface{} `json:"data"`
}

ResponseEntity 响应数据体

Jump to

Keyboard shortcuts

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