Documentation
¶
Overview ¶
ultra stupid web framework
Index ¶
- type Context
- func (c *Context) Bind(v any) error
- func (c *Context) Context() context.Context
- func (c *Context) Form(key string) string
- func (c *Context) Get(key string) any
- func (c *Context) HTML(code int, html string) error
- func (c *Context) Header(key string) string
- func (c *Context) JSON(code int, obj any) error
- func (c *Context) Param(key string) string
- func (c *Context) Query(key string) string
- func (c *Context) Request() *http.Request
- func (c *Context) ResponseWriter() http.ResponseWriter
- func (c *Context) Set(key string, value any)
- func (c *Context) String(code int, text string) error
- type Ctx
- type Experiment
- type ExperimentCondition
- type HandlerFunc
- type Magic
- type MiddlewareFunc
- type PathPrefixCondition
- type Route
- type Spell
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
context implementation
func (*Context) ResponseWriter ¶
func (c *Context) ResponseWriter() http.ResponseWriter
type Ctx ¶
type Ctx interface {
// request data
Param(key string) string
Query(key string) string
Form(key string) string
Header(key string) string
// request body
Bind(v any) error
// response
String(code int, text string) error
JSON(code int, obj any) error
HTML(code int, html string) error
// context
Set(key string, value any)
Get(key string) any
Context() context.Context
// internal
Request() *http.Request
ResponseWriter() http.ResponseWriter
}
type Experiment ¶
type Experiment struct {
// contains filtered or unexported fields
}
func (*Experiment) Given ¶
func (e *Experiment) Given(conditions ...ExperimentCondition) *Experiment
what you would like to sacrifice ?
func (*Experiment) Subject ¶
func (e *Experiment) Subject(spells ...*Spell) *Experiment
type ExperimentCondition ¶
type ExperimentCondition interface {
Apply(*Experiment) *Experiment
}
func PathPrefix ¶
func PathPrefix(prefix string) ExperimentCondition
type HandlerFunc ¶
type Magic ¶
type Magic struct {
// contains filtered or unexported fields
}
func SpellMagic ¶
func SpellMagic() *Magic
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
type PathPrefixCondition ¶
type PathPrefixCondition struct {
// contains filtered or unexported fields
}
func (PathPrefixCondition) Apply ¶
func (p PathPrefixCondition) Apply(exp *Experiment) *Experiment
type Route ¶
type Route struct {
Method string
Path string
Handler HandlerFunc
Middlewares []MiddlewareFunc
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.