helpers

package
v0.0.0-...-203e069 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DateAfterY1

func DateAfterY1(t time.Time) bool

DateAfterY1 is used to verify that a date is after the year 1 (since go hates nulls)

func DefaultData

DefaultData adds default data which is accessible to all templates

func FormatDateWithLayout

func FormatDateWithLayout(t time.Time, f string) string

FormatDateWithLayout formats a time with provided (go compliant) format string, and returns it as a string

func HumanDate

func HumanDate(t time.Time) string

HumanDate formats a time in YYYY-MM-DD format

func IsAuthenticated

func IsAuthenticated(r *http.Request) bool

IsAuthenticated returns true if a user is authenticated

func NewHelpers

func NewHelpers(a *config.AppConfig)

NewHelpers creates new helpers

func RandomString

func RandomString(n int) string

RandomString returns a random string of letters of length n

func RenderPage

func RenderPage(w http.ResponseWriter, r *http.Request, templateName string, variables, data interface{}) error

RenderPage renders a page using jet templates

func SendEmail

func SendEmail(mailMessage channeldata.MailData)

SendEmail sends an email

func ServerError

func ServerError(w http.ResponseWriter, r *http.Request, err error)

ServerError will display error page for internal server error

Types

This section is empty.

Jump to

Keyboard shortcuts

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