handler

package
v0.0.0-...-5781841 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ping

func Ping(ctx *gin.Context)

@Summary Ping

@Description Ping @Tags demo @Accept application/json @Produce application/json @Success 200 {object} ApiResp{data=types.PingResp} "success" @Failure 401 {object} ApiResp{data=string} "权限不足" @Failure 500 {object} ApiResp{} "服务器内部错误" @Router /Ping [GET]

Types

type ApiResp

type ApiResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data any    `json:"data,omitempty" swaggerignore:"true"`
}

所有200 的接口 resp 必须为ApiResp

type GetApi

type GetApi struct {
	UriToFnNameM map[string]string
}

GetApi

func (GetApi) CheckAuth

func (a GetApi) CheckAuth(c *gin.Context) error

func (GetApi) ObjPing

func (a GetApi) ObjPing(ctx *gin.Context, req *struct{}) (ApiResp, error)

@Summary ObjPing

@Description ObjPing @Tags demo @Accept application/json @Produce application/json @Success 200 {object} ApiResp{data=types.PingResp} "success" @Failure 401 {object} ApiResp{data=string} "权限不足" @Failure 500 {object} ApiResp{} "服务器内部错误" @Router /v1/api/obj/ObjPing [GET]

func (GetApi) SendBad

func (a GetApi) SendBad(c *gin.Context, errMsg string)

func (GetApi) SendOk

func (a GetApi) SendOk(c *gin.Context, body any)

func (GetApi) UriToFnName

func (a GetApi) UriToFnName(uri string) string

type PostApi

type PostApi struct {
	UriToFnNameM map[string]string
}

PostApi

func (PostApi) CheckAuth

func (a PostApi) CheckAuth(c *gin.Context) error

func (PostApi) SendBad

func (a PostApi) SendBad(c *gin.Context, errMsg string)

func (PostApi) SendOk

func (a PostApi) SendOk(c *gin.Context, data any)

func (PostApi) UriToFnName

func (a PostApi) UriToFnName(uri string) string

Jump to

Keyboard shortcuts

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