ghelp

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SUCCESS = 0
	FAILED  = 1
)

Variables

This section is empty.

Functions

func GinFailed

func GinFailed(c *gin.Context)

web util

func GinFailedWithMsg

func GinFailedWithMsg(c *gin.Context, msg string)

func GinResultVO

func GinResultVO(c *gin.Context, result ResultVO)

func GinSuccess

func GinSuccess(c *gin.Context)

func GinSuccessWith

func GinSuccessWith(c *gin.Context, data interface{})

func GracefulExit

func GracefulExit(srv *http.Server)

func GracefulExitWithHook

func GracefulExitWithHook(srv *http.Server, hook func())

func WrapVoidFunc added in v1.0.1

func WrapVoidFunc(action func()) func(context *gin.Context)

Types

type ResultVO

type ResultVO struct {
	Data    interface{} `json:"data"`
	Code    int8        `json:"code"`
	Success bool        `json:"success"`
	Msg     string      `json:"msg"`
}

func Failed

func Failed() ResultVO

func FailedWithMsg

func FailedWithMsg(msg string) ResultVO

func Success

func Success() ResultVO

func SuccessWith

func SuccessWith(data interface{}) ResultVO

func (ResultVO) IsFailed

func (result ResultVO) IsFailed() bool

func (ResultVO) IsSuccess

func (result ResultVO) IsSuccess() bool

type StaticResource

type StaticResource struct {
	// 静态资源
	StaticFS embed.FS
	// 设置embed文件到静态资源的相对路径,也就是embed注释里的路径
	Path string
}

func (*StaticResource) Open

func (_this *StaticResource) Open(name string) (fs.File, error)

Open 静态资源被访问逻辑

Jump to

Keyboard shortcuts

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