helpers

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Map template.FuncMap = template.FuncMap{
	"development": func() bool {
		return web.Development
	},
	"manifest": func() _Manifest {
		return manifest
	},
	"timeFormat": func(date time.Time) string {
		return date.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...))
	},
}

Functions

func Error

func Error(c *fiber.Ctx, err error, code ...int) error

func NotFound

func NotFound(c *fiber.Ctx) error

func Query

func Query(queries map[string]string, vals ...any) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL