global

package
v0.0.0-...-26675b8 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GAD_R           *gin.Engine
	GAD_APP_PATH    string
	Config          *config.Config
	Db              *gorm.DB
	SuperAdmin      string
	EventDispatcher src.EventDispatcher
	Limiter         *rate.Limiter
)

Functions

func CaptchaServe

func CaptchaServe(w http.ResponseWriter, r *http.Request, id, ext, lang string, download bool, width, height int) error

CaptchaServe 验证码

func GetError

func GetError(errs validator.ValidationErrors, r interface{}) string

GetError 获取错误信息

func GetEventDispatcher

func GetEventDispatcher(c *gin.Context) *src.EventDispatcher

func IsSuperAdmin

func IsSuperAdmin(roles []string, role string) bool

IsSuperAdmin 即将废弃,请勿使用

func Pages

func Pages(page int, pageSize int, total int, rows interface{}) map[string]interface{}

Pages 通用分页

Types

type Del

type Del struct {
	Ids []uint `json:"id"`
}

type GAD_MODEL

type GAD_MODEL struct {
	ID        uint           `gorm:"primarykey" json:"id"` // 主键ID
	CreatedAt *LocalTime     `json:"created_at"`           // 创建时间
	UpdatedAt *LocalTime     `json:"updated_at"`           // 更新时间
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`       // 删除时间
}

type List

type List struct {
	Page     int                    `json:"page" form:"page"`
	PageSize int                    `json:"pageSize" form:"pageSize"`
	Where    map[string]interface{} `json:"where" form:"where"`
}

type LocalTime

type LocalTime time.Time

func (*LocalTime) MarshalJSON

func (t *LocalTime) MarshalJSON() ([]byte, error)

func (*LocalTime) Scan

func (t *LocalTime) Scan(v interface{}) error

func (LocalTime) Value

func (t LocalTime) Value() (driver.Value, error)

type MyJson

type MyJson map[string]interface{}

func (*MyJson) Scan

func (j *MyJson) Scan(value interface{}) error

func (MyJson) Value

func (j MyJson) Value() (driver.Value, error)

Value 实现 driver.Valuer 接口,Value 返回 json value

type Response

type Response struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func (Response) Failed

func (r Response) Failed(c *gin.Context, err string)

Failed disabled

func (Response) Success

func (r Response) Success(c *gin.Context, msg string, data interface{})

Success disabled

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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