123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package helpers
- import (
- "html/template"
- "strconv"
- "time"
- "github.com/brianvoe/gofakeit/v6"
- "github.com/gofiber/fiber/v2"
- "github.com/gofiber/template/html"
- )
- 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))
- })
- engine.AddFunc("ga", func() string {
- return ""
- })
- return fiber.Config{
- Views: engine,
- }
- }
|