Initial commit

This commit is contained in:
2025-09-06 21:35:45 -04:00
commit b02525e28a
32 changed files with 1478 additions and 0 deletions

33
pkg/router/route.go Normal file
View File

@@ -0,0 +1,33 @@
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
}