From a0d5fc860ae402c5504994c9d78110782dd2c2c0 Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Tue, 12 Sep 2023 13:28:06 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=BC=83=E7=94=A8=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/router/level_1_router.go | 11 ++++++++--- server/router/level_2_router.go | 11 ++++++++--- server/router/level_3_router.go | 12 ++++++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/server/router/level_1_router.go b/server/router/level_1_router.go index f49932f..fdcd3f5 100644 --- a/server/router/level_1_router.go +++ b/server/router/level_1_router.go @@ -6,7 +6,8 @@ import ( ) // NewLevel1Router 创建支持一级分类的路由器 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func NewLevel1Router[Route comparable, Handle any]() *Level1Router[Route, Handle] { return &Level1Router[Route, Handle]{ routes: map[Route]Handle{}, @@ -14,12 +15,15 @@ func NewLevel1Router[Route comparable, Handle any]() *Level1Router[Route, Handle } // Level1Router 支持一级分类的路由器 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 type Level1Router[Route comparable, Handle any] struct { routes map[Route]Handle } // Route 创建路由 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func (slf *Level1Router[Route, Handle]) Route(route Route, handleFunc Handle) { if reflect.TypeOf(handleFunc).Kind() != reflect.Func { panic(fmt.Errorf("route[%v] registration failed, handle must be a function type", route)) @@ -32,7 +36,8 @@ func (slf *Level1Router[Route, Handle]) Route(route Route, handleFunc Handle) { } // Match 匹配路由 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func (slf *Level1Router[Route, Handle]) Match(route Route) Handle { return slf.routes[route] } diff --git a/server/router/level_2_router.go b/server/router/level_2_router.go index 4fffd13..c7568e0 100644 --- a/server/router/level_2_router.go +++ b/server/router/level_2_router.go @@ -6,7 +6,8 @@ import ( ) // NewLevel2Router 创建支持二级分类的路由器 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func NewLevel2Router[Route comparable, Handle any]() *Level2Router[Route, Handle] { return &Level2Router[Route, Handle]{ routes: map[Route]map[Route]Handle{}, @@ -14,12 +15,15 @@ func NewLevel2Router[Route comparable, Handle any]() *Level2Router[Route, Handle } // Level2Router 支持二级分类的路由器 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 type Level2Router[Route comparable, Handle any] struct { routes map[Route]map[Route]Handle } // Route 创建路由 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func (slf *Level2Router[Route, Handle]) Route(topRoute Route, route Route, handleFunc Handle) { if reflect.TypeOf(handleFunc).Kind() != reflect.Func { panic(fmt.Errorf("route[%v] registration failed, handle must be a function type", route)) @@ -38,7 +42,8 @@ func (slf *Level2Router[Route, Handle]) Route(topRoute Route, route Route, handl } // Match 匹配路由 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func (slf *Level2Router[Route, Handle]) Match(topRoute Route, route Route) Handle { return slf.routes[topRoute][route] } diff --git a/server/router/level_3_router.go b/server/router/level_3_router.go index ad435ef..737e106 100644 --- a/server/router/level_3_router.go +++ b/server/router/level_3_router.go @@ -6,7 +6,8 @@ import ( ) // NewLevel3Router 创建支持三级分类的路由器 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func NewLevel3Router[Route comparable, Handle any]() *Level3Router[Route, Handle] { return &Level3Router[Route, Handle]{ routes: map[Route]map[Route]map[Route]Handle{}, @@ -14,13 +15,15 @@ func NewLevel3Router[Route comparable, Handle any]() *Level3Router[Route, Handle } // Level3Router 支持三级分类的路由器 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 type Level3Router[Route comparable, Handle any] struct { routes map[Route]map[Route]map[Route]Handle } // Route 创建路由 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func (slf *Level3Router[Route, Handle]) Route(topRoute Route, level2Route Route, route Route, handleFunc Handle) { if reflect.TypeOf(handleFunc).Kind() != reflect.Func { panic(fmt.Errorf("route[%v] registration failed, handle must be a function type", route)) @@ -43,7 +46,8 @@ func (slf *Level3Router[Route, Handle]) Route(topRoute Route, level2Route Route, } // Match 匹配路由 -// - Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 +// +// Deprecated: 从 Minotaur 0.1.7 开始,由于该路由器设计不合理,局限性大,已弃用。建议使用 Multistage 进行代替。 func (slf *Level3Router[Route, Handle]) Match(topRoute Route, level2Route Route, route Route) Handle { return slf.routes[topRoute][level2Route][route] }