framework

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MIT Imports: 13 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 Controller

func Controller(h interface{}, methodName ...string) server.HandlerFunc

Controller 转为 server.HandlerFunc

func ExtendContextMiddleware

func ExtendContextMiddleware(h server.HandlerFunc) server.HandlerFunc

ExtendContextMiddleware Context 拓展中间件

func GenTraceID

func GenTraceID() uint64

func HTTPErrorHandlerFunc

func HTTPErrorHandlerFunc(err error, ctx Context)

func HandleSucc

func HandleSucc() server.HandlerFunc

HandleSucc 返回成功

func InitLogger

func InitLogger()

func ToBase

func ToBase(h HandlerFunc) server.HandlerFunc

ToBase HandlerFunc 转为 server.HandlerFunc

func ToBaseHTTPErrorHandler

func ToBaseHTTPErrorHandler(h HTTPErrorHandler) server.HTTPErrorHandler

HandleError 返回失败

Types

type Context

type Context interface {
	server.Context
	Logger() Logger
	GetRequestID() uint64
	GetUID() int64
	Succ(interface{}) error
}

type HTTPErrorHandler

type HTTPErrorHandler func(error, Context)

type HandlerFunc

type HandlerFunc func(Context) error

type Logger

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

type Request

type Request interface {
	Verify() error
	Clear()
}

type Route

type Route struct {
	Method  reflect.Method
	Request reflect.Type
}

type RouteCache

type RouteCache map[string]map[string]Route

func (RouteCache) Make

func (RouteCache) Make(h interface{}) (reflect.Type, string, error)

Jump to

Keyboard shortcuts

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