api

package
v0.0.0-...-2cc2fc2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Unknown = ret.Init(0, "未知信息")

	Success  = ret.Init(2000, "操作成功")
	Exist    = ret.Init(2001, "数据已存在")
	NotExist = ret.Init(2002, "数据不存在")

	Failed           = ret.Init(4000, "操作失败")
	InvalidParams    = ret.Init(4001, "参数错误")
	PermissionDenied = ret.Init(4099, "没有访问权限")

	InternalError = ret.Init(5000, "系统异常")
)

Functions

func Json

func Json() gin.HandlerFunc

Json 使用JSON格式

Types

type Restful

type Restful struct {
	*ret.Struct
	Context *gin.Context `json:"-"`
	Token   string       `json:"token,omitempty"`
	// contains filtered or unexported fields
}

func Default

func Default(c *gin.Context) *Restful

Default 从gin Context中获取RESTFul数据

func (*Restful) Abort

func (z *Restful) Abort()

Abort 忽略后续的操作

func (*Restful) Error

func (z *Restful) Error(err error) *Restful

Error 根据服务器内部错误创建回调

func (*Restful) Response

func (z *Restful) Response(ret ret.Struct) *Restful

Response 发送响应信息

func (*Restful) Success

func (z *Restful) Success(data ...any) *Restful

Success 操作成功

Jump to

Keyboard shortcuts

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