working commit

This commit is contained in:
2026-02-06 19:15:12 +02:00
parent fe91517e3f
commit f76881a765
14 changed files with 478 additions and 20 deletions
+23
View File
@@ -22,6 +22,8 @@ type Context struct {
Request *http.Request
Writer http.ResponseWriter
PathMap map[string]string
Bools map[string]bool
Strings map[string]string
StatusCode int
}
@@ -32,10 +34,31 @@ func NewContext(writer http.ResponseWriter, request *http.Request) *Context {
Request: request,
Ctx: ctx,
PathMap: make(map[string]string),
Bools: make(map[string]bool),
Strings: make(map[string]string),
}
return rctx
}
// Aux maps
func (rctx *Context) SetBool(key string, value bool) {
rctx.Bools[key] = value
}
func (rctx *Context) GetBool(key string) (bool, bool) {
exists, value := rctx.Bools[key]
return exists, value
}
func (rctx *Context) SetString(key string, value string) {
rctx.Strings[key] = value
}
func (rctx *Context) GetString(key string) (string, bool) {
value, exists := rctx.Strings[key]
return value, exists
}
// Request
func (rctx *Context) GetSubpath(key string) (string, bool) {
value, exists := rctx.PathMap[key]