Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateMD5(input string) string
- func GenerateRandom(charset string, length int) string
- func GenerateRandomNumber(length int) string
- func GenerateRandomString(length int) string
- func GetBool(key string) bool
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetInt32(key string) int32
- func GetPostBool(ctx *gin.Context, name string, defaultValue bool) bool
- func GetPostInt(ctx *gin.Context, name string, defaultValue int) int
- func GetPostInt64(ctx *gin.Context, name string, defaultValue int64) int64
- func GetString(key string) string
- func InitConfig()
- func InitDB() *xorm.Engine
- func InitDBTable(engine *xorm.Engine)
- func OutErr(module, format string, v ...any)
- func OutLog(module, msg string)
- func OutLogf(module, format string, v ...any)
- func Reload()
- func ReturnData(ctx *gin.Context, state bool, obj any)
- func ReturnError(ctx *gin.Context, err CustomError)
- func ReturnMessage(ctx *gin.Context, state bool, message string)
- func ReturnMessageData(ctx *gin.Context, state bool, message string, obj any)
- func Set(key string, value interface{})
- type CustomError
- type CustomErrors
Constants ¶
View Source
const Version = "0.2.0"
Variables ¶
View Source
var Errors = CustomErrors{ NotLoginError: CustomError{false, 10100, "请先登录"}, TokenInvalidError: CustomError{false, 10101, "访问令牌无效"}, TokenIllegalError: CustomError{false, 10102, "访问令牌不合法"}, TokenNotAvailableError: CustomError{false, 10103, "令牌无法解析"}, PermissionDeniedError: CustomError{false, 10104, "权限不足"}, ParamEmptyError: CustomError{false, 10105, "缺少关键参数"}, ParamIllegalError: CustomError{false, 10106, "参数类型错误"}, UnexpectedError: CustomError{false, 99999, "发生意料之外的错误"}, }
Functions ¶
func CalculateMD5 ¶
func GenerateRandom ¶
func GenerateRandomNumber ¶
func GenerateRandomString ¶
func GetFloat64 ¶
func InitConfig ¶
func InitConfig()
func InitDBTable ¶
func ReturnError ¶
func ReturnError(ctx *gin.Context, err CustomError)
func ReturnMessageData ¶
Types ¶
type CustomError ¶
type CustomError struct { State bool `json:"state"` Code int `json:"code"` Message string `json:"message"` }
func (*CustomError) Error ¶
func (e *CustomError) Error() string
type CustomErrors ¶
type CustomErrors struct { // 未登录 NotLoginError CustomError // 令牌无效 TokenInvalidError CustomError // 令牌不合法 TokenIllegalError CustomError // 令牌不合法 TokenNotAvailableError CustomError // 权限不足 PermissionDeniedError CustomError // 参数为空 ParamEmptyError CustomError // 参数不合法 ParamIllegalError CustomError // 意料之外 UnexpectedError CustomError }
Click to show internal directories.
Click to hide internal directories.