core

package
v0.0.0-...-58fd0e2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 8 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 RtnStatus

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

func NewRtnStatus

func NewRtnStatus(code int, 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 int    `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