Documentation
¶
Index ¶
- func ConfigIsTrue(keys ...string) bool
- func EnableDebug()
- func GetConfig[V any](keys ...string) (*V, bool)
- func GetGlobalTemplateVar(key string) any
- func Go() error
- func RenderTemplate(name string, args map[string]any) (string, error)
- func Route(pattern string, function HandlerFunc)
- func SetConfigPath(newPath string)
- func SetGlobalTemplateVar(key string, value any)
- type HandlerFunc
- type InContext
- func (ctx InContext) Cookie(name string) *http.Cookie
- func (ctx InContext) Form() map[string]string
- func (ctx InContext) GetFile(name string) *multipart.FileHeader
- func (ctx InContext) GetForm(name string) string
- func (ctx InContext) GetHeader(name string) string
- func (ctx InContext) Headers() map[string]string
- func (ctx InContext) Request() *http.Request
- func (ctx InContext) URI() url.URL
- type OutContext
- func (ctx *OutContext) AddCookie(name string, value string) *http.Cookie
- func (ctx *OutContext) DeleteCookie(name string)
- func (ctx *OutContext) Redirect(path string, status int)
- func (ctx *OutContext) RenderTemplate(name string, args map[string]any) error
- func (ctx *OutContext) SetHeader(name string, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigIsTrue ¶
Check if a config value is set and equal to true.
func EnableDebug ¶
func EnableDebug()
func GetConfig ¶
Fetch a key from the root, a section, or a subsection of the config. Returns the value of the key (or nil) and whether or not the key was found.
func GetGlobalTemplateVar ¶
func RenderTemplate ¶
Render a template by its name.
func SetConfigPath ¶
func SetConfigPath(newPath string)
Set the path to the application config file. Note that this will have no effect if the configuration is already loaded or if the CONFIG_PATH environment variable is set.
func SetGlobalTemplateVar ¶
Types ¶
type HandlerFunc ¶
type HandlerFunc func(*OutContext, *InContext) error
type InContext ¶
type InContext struct {
// contains filtered or unexported fields
}
func (InContext) GetFile ¶
func (ctx InContext) GetFile(name string) *multipart.FileHeader
Get uploaded file header. Returns nil on failure.
type OutContext ¶
type OutContext struct { // public Writer bytes.Buffer ContentType string Status int // contains filtered or unexported fields }
The Output Context stores information (headers, new cookies, etc.) which is to be sent in the response.
func (*OutContext) AddCookie ¶
func (ctx *OutContext) AddCookie(name string, value string) *http.Cookie
Add a cookie. Returns the newly created cookie.
func (*OutContext) Redirect ¶
func (ctx *OutContext) Redirect(path string, status int)
func (*OutContext) RenderTemplate ¶
func (ctx *OutContext) RenderTemplate(name string, args map[string]any) error
Render a template out to the client.
func (*OutContext) SetHeader ¶
func (ctx *OutContext) SetHeader(name string, value string)
Set a header.
Click to show internal directories.
Click to hide internal directories.