handleFuncParse

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

解析struct或方法

提供给Router适配规则

可独立设置,也可通过Router间接设置

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearHandlerToRoute

func ClearHandlerToRoute() map[string]*HandleFunc

ClearHandlerToRoute 返回剩余未处理的handler

func LastHandler

func LastHandler()

LastHandler 返回未处理的handler

func MatchPrefixAndDelHandler

func MatchPrefixAndDelHandler(prefix string) map[string]*HandleFunc

MatchPrefixAndDelHandler 根据前缀匹配返回handler

func ParseFunc

func ParseFunc(structFuncName string, f func(*context.Context))

ParseFunc 直接注册方法

func ParseStruct

func ParseStruct(strut ControllerInstance, aliasName string)

ParseStruct 解析struct 生成方法与路由的映射关系 structName首字母转小写 如果aliasName不为空,则以aliasName为准 funcName也会首字母转小写

func ParseStructToRoute

func ParseStructToRoute(strut ControllerInstance, aliasName string) map[string]*HandleFunc

func ParseStructsToRoute

func ParseStructsToRoute(strut ...ControllerInstance) map[string]*HandleFunc

Types

type Control

type Control interface{}

type ControllerInstance

type ControllerInstance func() Control

type HandleFunc

type HandleFunc struct {
	StructFuncName string //原始struct名称和方法名称 如果为函数则名称为初始匹配名称
	// contains filtered or unexported fields
}

HandleFunc 处理方法

func MatchAndDelHandler

func MatchAndDelHandler(pattern string) *HandleFunc

MatchAndDelHandler key完全匹配返回handler并将其从库中删除

func ParseFuncToRoute

func ParseFuncToRoute(structFuncName string, f func(*context.Context)) *HandleFunc

func (*HandleFunc) Call

func (h *HandleFunc) Call(ctx *context.Context, args ...string) error

Call 调用函数或方法

Jump to

Keyboard shortcuts

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