From 62fb690417c3472b157fd033fb046b095b9b5e2a Mon Sep 17 00:00:00 2001 From: yusing Date: Sat, 24 Jan 2026 01:42:03 +0800 Subject: [PATCH] refactor(query): remove SearchRoute function and related documentation --- internal/config/query/README.md | 25 ------------------------- internal/config/query/query.go | 10 ---------- 2 files changed, 35 deletions(-) diff --git a/internal/config/query/README.md b/internal/config/query/README.md index 52427323..c10b3c07 100644 --- a/internal/config/query/README.md +++ b/internal/config/query/README.md @@ -54,12 +54,6 @@ Returns all route providers as a map keyed by their short name. Thread-safe acce func RouteProviderList() []RouteProviderListResponse ``` -Returns a list of route providers with their short and full names. Useful for API responses. - -```go -func SearchRoute(alias string) types.Route -``` - Searches for a route by alias across all providers. Returns `nil` if not found. ```go @@ -179,15 +173,6 @@ for shortName, provider := range providers { } ``` -### Searching for a route - -```go -route := statequery.SearchRoute("my-service") -if route != nil { - fmt.Printf("Found route: %s\n", route.Alias()) -} -``` - ### Getting system statistics ```go @@ -213,14 +198,4 @@ func handleGetStats(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(stats) } - -func handleFindRoute(w http.ResponseWriter, r *http.Request) { - alias := r.URL.Query().Get("alias") - route := statequery.SearchRoute(alias) - if route == nil { - http.NotFound(w, r) - return - } - json.NewEncoder(w).Encode(route) -} ``` diff --git a/internal/config/query/query.go b/internal/config/query/query.go index a8198616..b267ab21 100644 --- a/internal/config/query/query.go +++ b/internal/config/query/query.go @@ -30,13 +30,3 @@ func RouteProviderList() []RouteProviderListResponse { } return list } - -func SearchRoute(alias string) types.Route { - state := config.ActiveState.Load() - for _, p := range state.IterProviders() { - if r, ok := p.GetRoute(alias); ok { - return r - } - } - return nil -}