router

package
v0.0.0-...-4c98282 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFunc

type CallbackFunc func(ctx *app.RequestContext) bool

CallbackFunc 在进行分发前进行回调的函数, 返回true结束

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(config HandlerCfg, logger logger.ILog) *Handler

func (*Handler) AddController

func (h *Handler) AddController(v interface{}) *controller.Controller

func (*Handler) AddInterceptor

func (h *Handler) AddInterceptor(i interceptor.Interceptor, order int)

func (*Handler) Dispatch

func (h *Handler) Dispatch(ctx *app.RequestCtx)

func (*Handler) GetCtxPool

func (h *Handler) GetCtxPool() *sync.Pool

func (*Handler) IsRunning

func (h *Handler) IsRunning() bool

func (*Handler) Register

func (h *Handler) Register(ctl *controller.RestfulController)

func (*Handler) RegisterGRPCService

func (h *Handler) RegisterGRPCService(serviceDesc *grpc.ServiceDesc, srv interface{}) *controller.Controller

func (*Handler) Serve

func (h *Handler) Serve(ctx *app.RequestCtx)

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Handler) SetAfterDispatchCallBack

func (h *Handler) SetAfterDispatchCallBack(callbackFunc CallbackFunc)

func (*Handler) SetBeforeDispatchCallBack

func (h *Handler) SetBeforeDispatchCallBack(callbackFunc CallbackFunc)

func (*Handler) SetRunning

func (h *Handler) SetRunning(val bool) bool

SetRunning 设置运行状态

func (*Handler) SortInterceptors

func (h *Handler) SortInterceptors()

type HandlerCfg

type HandlerCfg struct {
	Name                   string        `yaml:"name" default:"default"`
	RootPath               string        `yaml:"rootPath"` // 可以为空
	HeaderTraceID          string        `yaml:"headerTraceID" default:"X-Request-Id"`
	ControllerRootPkgName  string        `yaml:"controllerRootPkgName" default:"controller"`
	EnablePprof            bool          `yaml:"enablePprof"`
	WebLimiter             LimiterConfig `yaml:"webLimiter"`
	EnableMetrics          bool          `yaml:"enableMetrics"`
	DisableOptimization    bool          `yaml:"disableOptimization"`
	EnableActionController bool          `yaml:"enableActionController"`
	EnableSwagger          bool          `yaml:"enableSwagger"`
}

type HandlersChain

type HandlersChain []method.Method

type LimiterConfig

type LimiterConfig struct {
	Enable bool `yaml:"enable"`
	Qos    int  `yaml:"qos" default:"1000"`
}

type MethodTrees

type MethodTrees []*router

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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