Documentation ¶
Overview ¶
Package flight provides access to the application settings safely.
Index ¶
- func Reset()
- func StoreConfig(ci env.Info)
- func StoreDB(db *sqlx.DB)
- func StoreXsrf(x xsrf.Info)
- func Xsrf() xsrf.Info
- type Info
- func (c *Info) FlashError(err error)
- func (c *Info) FlashErrorGeneric(err error)
- func (c *Info) FlashNotice(message string)
- func (c *Info) FlashSuccess(message string)
- func (c *Info) FlashWarning(message string)
- func (c *Info) FormValid(fields ...string) bool
- func (c *Info) Param(name string) string
- func (c *Info) Redirect(urlStr string)
- func (c *Info) Repopulate(v map[string]interface{}, fields ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StoreConfig ¶
StoreConfig stores the application settings so controller functions can access them safely.
Types ¶
type Info ¶
type Info struct { Config env.Info Sess *sessions.Session UserID string W http.ResponseWriter R *http.Request View view.Info DB *sqlx.DB }
Info structures the application settings.
func Context ¶
func Context(w http.ResponseWriter, r *http.Request) Info
Context returns the application settings.
func (*Info) FlashError ¶
FlashError saves an error flash and logs the error.
func (*Info) FlashErrorGeneric ¶
FlashErrorGeneric saves a generic error flash and logs the error.
func (*Info) FlashNotice ¶
FlashNotice saves a notice flash.
func (*Info) FlashSuccess ¶
FlashSuccess saves a success flash.
func (*Info) FlashWarning ¶
FlashWarning saves a warning flash.
func (*Info) FormValid ¶
FormValid determines if the user submitted all the required fields and then saves an error flash. Returns true if form is valid.
func (*Info) Repopulate ¶
Repopulate fills the forms on the page after the user submits.