core

package
v0.0.0-...-cc6c6cb Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success = &RtnStatus{200, "请求成功"}
	Fail    = &RtnStatus{0, "请求失败"}
)
View Source
var ProviderCoreSet = wire.NewSet(system.NewAppContext)

Functions

func WrapData

func WrapData(handler WrappedHandlerFunc) func(*gin.Context)

WrapData 包装响应结果

Types

type CodeType

type CodeType int
const (
	// CodeSuccess 请求成功
	CodeSuccess CodeType = 200
	// CodeError 请求失败
	CodeError CodeType = 0
	// CodePassError 密码错误
	CodePassError CodeType = 400
	// CodeInvalid 网盘资源失效
	CodeInvalid CodeType = 401
	// CodeUnAuth 未授权
	CodeUnAuth CodeType = 403
	// CodeLogin 需要登录
	CodeLogin CodeType = 405
	// CodeWechatPwd 微信密码错误
	CodeWechatPwd CodeType = 406
	// CodeSignError 签名错误
	CodeSignError CodeType = 407
	// CodeCoinNotEnough 积分不足
	CodeCoinNotEnough CodeType = 408
	// CodeNeedVIP 需要VIP
	CodeNeedVIP CodeType = 409
	// NeedBuy 需要购买
	NeedBuy CodeType = 410
)

type RtnStatus

type RtnStatus struct {
	Code    CodeType `json:"code"`
	Message string   `json:"message"`
}

func NewListRtn

func NewListRtn[T ~int | ~int64](data any, total T) (gin.H, *RtnStatus)

func NewRtnStatus

func NewRtnStatus(code CodeType, message string) *RtnStatus

func NewRtnWithErr

func NewRtnWithErr(err error) *RtnStatus

type Test

type Test struct {
	Logger *zap.SugaredLogger
	Conf   *koanf.Koanf
	Ctx    *system.AppContext
}

Test for test env

func NewTestApp

func NewTestApp(logger *zap.SugaredLogger, ctx *system.AppContext, conf *koanf.Koanf) *Test

func TestApp

func TestApp() (*Test, func(), error)

type WrappedHandlerFunc

type WrappedHandlerFunc func(*gin.Context) (any, *RtnStatus)

type WrappedResp

type WrappedResp struct {
	Code CodeType `json:"code"`
	Msg  string   `json:"msg"`
	Data any      `json:"data"`
}

WrappedResp 被包装的输出结构

Jump to

Keyboard shortcuts

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