response

package
v0.0.0-...-66fcd57 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCode

type ErrCode int
var (
	ReqOk ErrCode = 2000
)

type IResponse

type IResponse interface {
	New() IResponse
	WithCode(code ErrCode) IResponse
	WithSuccess(success bool) IResponse
	WithMessage(message string) IResponse
	WithData(data interface{}) IResponse
	WithData2(data interface{}) IResponse
	WithTotal(total int64) IResponse
	WithPage(page int) IResponse
	WithPageSize(pageSize int) IResponse

	Success(ctx *gin.Context)
	Fail(ctx *gin.Context)
	// contains filtered or unexported methods
}

func New

func New() IResponse

type Response

type Response struct {
	Code          ErrCode     `json:"code"`
	IsSuccess     bool        `json:"success"`
	Message       string      `json:"message"`
	IV            string      `json:"iv,omitempty"`
	Encrypted     bool        `json:"encrypted,omitempty"`
	EncryptedType string      `json:"encrypted_type,omitempty"`
	Data          interface{} `json:"data,omitempty"`
	Data2         interface{} `json:"data2,omitempty"`
	Time          int64       `json:"time,omitempty"`
	Total         int64       `json:"total,omitempty"`
	Page          int         `json:"page,omitempty"`
	PageSize      int         `json:"page_size,omitempty"`
}

func (*Response) Fail

func (r *Response) Fail(ctx *gin.Context)

func (*Response) New

func (r *Response) New() IResponse

func (*Response) Success

func (r *Response) Success(ctx *gin.Context)

func (*Response) WithCode

func (r *Response) WithCode(code ErrCode) IResponse

func (*Response) WithData

func (r *Response) WithData(data interface{}) IResponse

func (*Response) WithData2

func (r *Response) WithData2(data interface{}) IResponse

func (*Response) WithMessage

func (r *Response) WithMessage(message string) IResponse

func (*Response) WithPage

func (r *Response) WithPage(page int) IResponse

func (*Response) WithPageSize

func (r *Response) WithPageSize(pageSize int) IResponse

func (*Response) WithSuccess

func (r *Response) WithSuccess(success bool) IResponse

func (*Response) WithTotal

func (r *Response) WithTotal(total int64) IResponse

Jump to

Keyboard shortcuts

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