apis

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(c *gin.Context, code int, args ...interface{})

Fail response fail with code, err, field

func Ok

func Ok(c *gin.Context, args ...interface{})

Ok ...

func Out

func Out(c *gin.Context, code int, args ...interface{})

Out ...

func Register

func Register(name string, sf Strapper)

Register ...

func Routers

func Routers(r gin.IRouter, names ...string)

Routers ...

Types

type Error

type Error struct {
	Code    int    `json:"code" description:"错误代码"`
	Message string `json:"message,required" description:"错误信息"`
	Field   string `json:"field,omitempty" description:"错误字段,可选,多用于表单校验"`
}

Error ...

func GetError

func GetError(r *http.Request, code int, err interface{}, args ...interface{}) Error

type FieldError

type FieldError interface {
	Field() string
}

FieldError ...

type IError

type IError interface {
	GetCode() int
	GetMessage() string
	GetField() string
}

IError ...

type StrapFunc

type StrapFunc func(r gin.IRouter)

StrapFunc ...

func (StrapFunc) Strap

func (f StrapFunc) Strap(r gin.IRouter)

Strap ...

type Strapper

type Strapper interface {
	Strap(r gin.IRouter)
}

Strapper ...

Jump to

Keyboard shortcuts

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