Documentation ¶
Index ¶
- Constants
- Variables
- func AssignForm(form interface{}, data map[string]interface{})
- func DeleteLocaleCookie(resp http.ResponseWriter)
- func DeleteRedirectToCookie(resp http.ResponseWriter)
- func GetInclude(field reflect.StructField) string
- func GetMaxSize(field reflect.StructField) string
- func GetMinSize(field reflect.StructField) string
- func GetSiteCookie(req *http.Request, name string) string
- func GetSize(field reflect.StructField) string
- func IsAPIPath(req *http.Request) bool
- func Locale(resp http.ResponseWriter, req *http.Request) translation.Locale
- func SetLocaleCookie(resp http.ResponseWriter, lang string, maxAge int)
- func SetRedirectToCookie(resp http.ResponseWriter, value string)
- func SetSiteCookie(resp http.ResponseWriter, name, value string, maxAge int)
- func Validate(errs binding.Errors, data map[string]interface{}, f Form, l translation.Locale) binding.Errors
- func WithContextData(c context.Context) context.Context
- type ContextData
- type ContextDataStore
- type Flash
- type Form
Constants ¶
const ( SuccessFlash = "SuccessMsg" ErrorFlash = "ErrorMsg" WarnFlash = "WarningMsg" InfoFlash = "InfoMsg" )
flashes enumerates all the flash types
const ContextDataKeySignedUser = "SignedUser"
Variables ¶
var FlashNow bool
FlashNow FIXME:
Functions ¶
func AssignForm ¶
func AssignForm(form interface{}, data map[string]interface{})
AssignForm assign form values back to the template data.
func DeleteLocaleCookie ¶
func DeleteLocaleCookie(resp http.ResponseWriter)
DeleteLocaleCookie convenience function to delete the locale cookie consistently Setting the lang cookie will trigger the middleware to reset the language to previous state.
func DeleteRedirectToCookie ¶
func DeleteRedirectToCookie(resp http.ResponseWriter)
DeleteRedirectToCookie convenience function to delete most cookies consistently
func GetInclude ¶
func GetInclude(field reflect.StructField) string
GetInclude get include in form tag
func GetMaxSize ¶
func GetMaxSize(field reflect.StructField) string
GetMaxSize get max size in form tag
func GetMinSize ¶
func GetMinSize(field reflect.StructField) string
GetMinSize get minimal size in form tag
func GetSiteCookie ¶
GetSiteCookie returns given cookie value from request header.
func Locale ¶
func Locale(resp http.ResponseWriter, req *http.Request) translation.Locale
Locale handle locale
func SetLocaleCookie ¶
func SetLocaleCookie(resp http.ResponseWriter, lang string, maxAge int)
SetLocaleCookie convenience function to set the locale cookie consistently
func SetRedirectToCookie ¶
func SetRedirectToCookie(resp http.ResponseWriter, value string)
SetRedirectToCookie convenience function to set the RedirectTo cookie consistently
func SetSiteCookie ¶
func SetSiteCookie(resp http.ResponseWriter, name, value string, maxAge int)
SetSiteCookie returns given cookie value from request header.
Types ¶
type ContextData ¶
func CommonTemplateContextData ¶
func CommonTemplateContextData() ContextData
func GetContextData ¶
func GetContextData(c context.Context) ContextData
func (ContextData) GetData ¶
func (ds ContextData) GetData() map[string]any
func (ContextData) MergeFrom ¶
func (ds ContextData) MergeFrom(other ContextData) ContextData
type ContextDataStore ¶
type ContextDataStore interface {
GetData() ContextData
}
ContextDataStore represents a data store