Documentation
¶
Index ¶
- Constants
- Variables
- func Error(c *fiber.Ctx, err error, codes ...int) error
- func IsHTMXRequest(c *fiber.Ctx) bool
- func NotFound(c *fiber.Ctx) error
- func Query(queries map[string]string, vals ...any) string
- func Redirect(c *fiber.Ctx, path string) error
- func Render(c *fiber.Ctx, name string, data fiber.Map, layouts ...string) error
- type Meta
Constants ¶
View Source
const AnonymousContextKey = "anonymous_key"
View Source
const CSRFContextKey = "csrf_key"
Variables ¶
View Source
var Map template.FuncMap = template.FuncMap{ "build": func() build.Build { return build.Current }, "headTags": func() template.HTML { return template.HTML(web.HeadTags) }, "timeFormat": func(date time.Time) string { return date.Local().Format("Jan _2 2006 15:04:05") }, "timeHumanize": func(date time.Time) string { return humanize.Time(date) }, "bytesHumanize": func(bytes int64) string { return humanize.Bytes(uint64(bytes)) }, "json": func(data any) string { jsonData, err := json.MarshalIndent(data, "", " ") if err != nil { panic(err) } return string(jsonData) }, "unescape": func(s string) template.HTML { return template.HTML(s) }, "query": func(queries map[string]string, vals ...any) template.URL { return template.URL(Query(queries, vals...)) }, "set": func(c fiber.Map, name string, value any) fiber.Map { return fiber.Map{ "Meta": c["Meta"], name: value, } }, "csrf": func(c fiber.Map) template.HTML { return template.HTML(fmt.Sprintf(`<input type="hidden" name="csrf" value="%s" />`, c["Meta"].(Meta).CSRF)) }, }
Functions ¶
func IsHTMXRequest ¶ added in v0.12.0
Types ¶
Click to show internal directories.
Click to hide internal directories.