api

package
v1.32.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGetLogger

func MustGetLogger(c *gin.Context) *logger.KLogger

MustGetLogger 获取上下文提供的日志

func MustGetOrm

func MustGetOrm(c *gin.Context) *gorm.DB

GetOrm 获取orm连接

Types

type Api

type Api struct {
	Context *gin.Context
	Logger  *logger.KLogger
	Orm     *gorm.DB
	Errors  error
}

func (*Api) Bind

func (e *Api) Bind(d interface{}, bindings ...binding.Binding) *Api

Bind 参数校验

func (Api) Custom

func (e Api) Custom(data gin.H)

Custom 兼容函数

func (Api) Error

func (e Api) Error(err error)

Error 通常错误数据处理

func (*Api) GetIdentity

func (e *Api) GetIdentity() *service.AuthIdentity

func (*Api) MakeContext

func (e *Api) MakeContext(c *gin.Context) *Api

MakeContext 设置http上下文

func (*Api) MakeService

func (e *Api) MakeService(c *service.Service) *Api

func (Api) OK

func (e Api) OK(data interface{}, msg string)

OK 通常成功数据处理

func (Api) PageOK

func (e Api) PageOK(result interface{}, count int, pageIndex int, pageSize int, msg string)

PageOK 分页数据处理

func (*Api) SetError

func (e *Api) SetError(err error)

func (Api) Translate

func (e Api) Translate(form, to interface{})

Jump to

Keyboard shortcuts

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