Documentation ¶
Index ¶
- Constants
- Variables
- func AssignForm(form interface{}, data map[string]interface{})
- func DeleteCSRFCookie(resp http.ResponseWriter)
- func DeleteLocaleCookie(resp http.ResponseWriter)
- func DeleteRedirectToCookie(resp http.ResponseWriter)
- func Domain(domain string) func(*http.Cookie)
- func Expires(expires time.Time) func(*http.Cookie)
- func GetCookie(req *http.Request, name string) string
- func GetInclude(field reflect.StructField) string
- func GetMaxSize(field reflect.StructField) string
- func GetMinSize(field reflect.StructField) string
- func GetSize(field reflect.StructField) string
- func HTTPOnly(httpOnly bool) func(*http.Cookie)
- func IsAPIPath(req *http.Request) bool
- func IsInternalPath(req *http.Request) bool
- func Locale(resp http.ResponseWriter, req *http.Request) translation.Locale
- func MaxAge(maxAge int) func(*http.Cookie)
- func NewCookie(name, value string, maxAge int) *http.Cookie
- func Path(path string) func(*http.Cookie)
- func SameSite(sameSite http.SameSite) func(*http.Cookie)
- func Secure(secure bool) func(*http.Cookie)
- func SetCookie(resp http.ResponseWriter, name, value string, others ...interface{})
- func SetLocaleCookie(resp http.ResponseWriter, lang string, expiry int)
- func SetRedirectToCookie(resp http.ResponseWriter, value string)
- func Validate(errs binding.Errors, data map[string]interface{}, f Form, l translation.Locale) binding.Errors
- type DataStore
- type Flash
- type Form
Constants ¶
const ( SuccessFlash = "SuccessMsg" ErrorFlash = "ErrorMsg" WarnFlash = "WarningMsg" InfoFlash = "InfoMsg" )
flashes enumerates all the flash types
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 DeleteCSRFCookie ¶
func DeleteCSRFCookie(resp http.ResponseWriter)
DeleteCSRFCookie convenience function to delete SessionConfigPath cookies consistently
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 ot 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 IsInternalPath ¶
IsInternalPath returns true if the specified URL is an internal API path
func Locale ¶
func Locale(resp http.ResponseWriter, req *http.Request) translation.Locale
Locale handle locale
func SetCookie ¶
func SetCookie(resp http.ResponseWriter, name, value string, others ...interface{})
SetCookie set the cookies. (name, value, lifetime, path, domain, secure, httponly, expires, {sameSite, ...}) TODO: Copied from gitea.com/macaron/macaron and should be improved after macaron removed.
func SetLocaleCookie ¶
func SetLocaleCookie(resp http.ResponseWriter, lang string, expiry 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
Types ¶
type DataStore ¶
type DataStore interface {
GetData() map[string]interface{}
}
DataStore represents a data store