framework

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AccessLog  logger.Writer
	ConsoleLog logger.Writer
	AppLog     logger.Writer
	ErrorLog   logger.Writer
)
View Source
var Hostname string

Functions

func App

func App() *server.Server

func AppHTTPErrorHandler added in v0.4.3

func AppHTTPErrorHandler(err error, ctx Context)

func BaseHTTPErrorHandler added in v0.4.3

func BaseHTTPErrorHandler(h HTTPErrorHandler) server.HTTPErrorHandler

BaseHTTPErrorHandler 返回失败

func BaseHTTPOKHandler added in v0.5.1

func BaseHTTPOKHandler(h HTTPOKHandler) server.HTTPOKHandler

BaseHTTPOKHandler 返回失败

func BaseHandlerFunc added in v0.4.3

func BaseHandlerFunc(h HandlerFunc) server.HandlerFunc

BaseHandlerFunc HandlerFunc 转为 server.HandlerFunc

func ExtendContextMiddleware

func ExtendContextMiddleware(h server.HandlerFunc) server.HandlerFunc

ExtendContextMiddleware Context 拓展中间件

func HandleSucc

func HandleSucc() server.HandlerFunc

HandleSucc 返回成功

func InitLogger

func InitLogger()

Types

type Context

type Context interface {
	server.Context
	Logger() Logger
	RequestID() uint64
	UID() uint64
	RealIP() string
	Succ(any) error
}

type HTTPErrorHandler

type HTTPErrorHandler func(error, Context)

type HTTPOKHandler added in v0.5.1

type HTTPOKHandler func(any, Context) error

type HandlerFunc

type HandlerFunc func(Context) error

type Logger

type Logger interface {
	Alert(format string, a ...any)  // 1
	Error(format string, a ...any)  // 3
	Warn(format string, a ...any)   // 4
	Notice(format string, a ...any) // 5
	Info(format string, a ...any)   // 6
	Debug(format string, a ...any)  // 7
}

Jump to

Keyboard shortcuts

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