1234567891011121314151617181920212223242526272829303132333435363738 |
- package test
- import (
- "html/template"
- "strconv"
- "time"
- "github.com/brianvoe/gofakeit/v6"
- "github.com/gofiber/fiber/v2"
- "github.com/gofiber/template/html/v2"
- )
- func GetFiberTestConfig() fiber.Config {
- engine := html.New("./../../templates", ".html")
- // nolint:gocritic
- engine.AddFunc("now", func() time.Time {
- return time.Now()
- })
- // nolint:gosec
- engine.AddFunc("noescape", func(str string) template.HTML {
- return template.HTML(str)
- })
- engine.AddFunc("gridsep", func(i, l int) bool {
- i++
- return i%3 == 0 && i != l
- })
- engine.AddFunc("version", func() string {
- return strconv.Itoa(gofakeit.Number(1, 1000))
- })
- return fiber.Config{
- Views: engine,
- }
- }
|