Files
addrss.io/pkg/router/route.go
2025-09-06 21:35:45 -04:00

34 lines
606 B
Go

package router
type Route struct {
handler func(*Context)
method string
anonymous bool
scope string
params map[string]any
path string
bindModel any
}
func (r Route) Anonymous() Route {
for i, route := range routeMap[r.method] {
if route.path == r.path {
routeMap[r.method][i].scope = ""
routeMap[r.method][i].anonymous = true
}
}
return r
}
func (r Route) RequireScope(scope string) Route {
for i, route := range routeMap[r.method] {
if route.path == r.path {
routeMap[r.method][i].scope = scope
routeMap[r.method][i].anonymous = false
}
}
return r
}