router

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GinLogger = gin.LoggerWithFormatter(func(p gin.LogFormatterParams) string {
	return fmt.Sprintf(`{"time":"%s","client":"%s","method":"%s","path":"%s","latency":"%s","status":%d,"emsg":"%s"}`+"\n",
		p.TimeStamp.Format(time.DateTime),
		p.ClientIP,
		p.Method,
		p.Path,
		p.Latency,
		p.StatusCode,
		p.ErrorMessage,
	)
})

Functions

func LaunchServer

func LaunchServer(ctx context.Context, wg *sync.WaitGroup, r *gin.Engine, cfg *config.Config)

func Register

func Register(r *gin.Engine, cfg *config.Config, l logger.Logger, staticFiles embed.FS) *gin.Engine

func RegisterTimeLogRoutes

func RegisterTimeLogRoutes(group *gin.RouterGroup)

RegisterTimeLogRoutes 注册 TimeLog 相关路由

Types

type ApiResponse

type ApiResponse struct {
	Data    interface{} `json:"data"`
	Message string      `json:"message,omitempty"`
	Status  int         `json:"status"`
}

ApiResponse 统一API响应结构

func ErrorResponse

func ErrorResponse(status int, message string) ApiResponse

ErrorResponse 错误响应

func SuccessResponse

func SuccessResponse(data interface{}, message ...string) ApiResponse

SuccessResponse 成功响应

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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