response

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package response 服务响应处理

Index

Constants

View Source
const (
	CodeSuccess             = 100000
	CodeRequestParamInvalid = 100001
	CodeServerErrUnknown    = 200000
)

Variables

This section is empty.

Functions

func Write

func Write(ctx *gin.Context, data interface{})

Write 写回数据

func WriteBase

func WriteBase(ctx *gin.Context, err interface{})

WriteBase 写回数据

func WriteBaseID

func WriteBaseID(ctx *gin.Context, id int64) error

WriteBaseID 写回带ID的数据

func WriteBasePage

func WriteBasePage(ctx *gin.Context, list interface{}, total int64) error

WriteBasePage 写回带分页的数据

func WriteData

func WriteData(ctx *gin.Context, data, err interface{})

WriteData 写回数据

func WriteParamInvalid

func WriteParamInvalid(ctx *gin.Context, err interface{})

WriteParamInvalid 写回参数错误信息

Types

type Base

type Base struct {
	BaseRsp *BaseRsp    `json:"baseRsp"`
	Data    interface{} `json:"data"`
}

Base 通用响应

type BaseRsp

type BaseRsp struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg"`
}

BaseRsp 通用响应

Jump to

Keyboard shortcuts

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