{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package middleware\n\n## Constants\n\n```go\nconst (\n\tSuccessFlash = \"SuccessMsg\"\n\tErrorFlash   = \"ErrorMsg\"\n\tWarnFlash    = \"WarningMsg\"\n\tInfoFlash    = \"InfoMsg\"\n)\n```\nflashes enumerates all the flash types\n\n## Variables\n\n```go\nvar (\n\t// FlashNow FIXME:\n\tFlashNow bool\n)\n```\n\n## Functions\n\n```go\nfunc AssignForm(form interface{}, data map[string]interface{})\n```\nAssignForm assign form values back to the template data.\n\n```go\nfunc DeleteCSRFCookie(resp http.ResponseWriter)\n```\nDeleteCSRFCookie convenience function to delete SessionConfigPath cookies consistently\n\n```go\nfunc DeleteLocaleCookie(resp http.ResponseWriter)\n```\nDeleteLocaleCookie convenience function to delete the locale cookie consistently Setting the lang cookie will trigger the middleware to reset the language ot previous state.\n\n```go\nfunc DeleteRedirectToCookie(resp http.ResponseWriter)\n```\nDeleteRedirectToCookie convenience function to delete most cookies consistently\n\n```go\nfunc DeleteSesionConfigPathCookie(resp http.ResponseWriter, name string)\n```\nDeleteSesionConfigPathCookie convenience function to delete SessionConfigPath cookies consistently\n\n```go\nfunc Domain(domain string) func(*http.Cookie)\n```\nDomain sets the domain for a provided cookie\n\n```go\nfunc Expires(expires time.Time) func(*http.Cookie)\n```\nExpires sets the expires and rawexpires for a provided cookie\n\n```go\nfunc GetCookie(req *http.Request, name string) string\n```\nGetCookie returns given cookie value from request header.\n\n```go\nfunc GetInclude(field reflect.StructField) string\n```\nGetInclude get include in form tag\n\n```go\nfunc GetMaxSize(field reflect.StructField) string\n```\nGetMaxSize get max size in form tag\n\n```go\nfunc GetMinSize(field reflect.StructField) string\n```\nGetMinSize get minimal size in form tag\n\n```go\nfunc GetSize(field reflect.StructField) string\n```\nGetSize get size int form tag\n\n```go\nfunc HTTPOnly(httpOnly bool) func(*http.Cookie)\n```\nHTTPOnly sets the HttpOnly setting for a provided cookie\n\n```go\nfunc IsAPIPath(req *http.Request) bool\n```\nIsAPIPath returns true if the specified URL is an API path\n\n```go\nfunc IsInternalPath(req *http.Request) bool\n```\nIsInternalPath returns true if the specified URL is an internal API path\n\n```go\nfunc Locale(resp http.ResponseWriter, req *http.Request) translation.Locale\n```\nLocale handle locale\n\n```go\nfunc MaxAge(maxAge int) func(*http.Cookie)\n```\nMaxAge sets the maximum age for a provided cookie\n\n```go\nfunc NewCookie(name, value string, maxAge int) *http.Cookie\n```\nNewCookie creates a cookie\n\n```go\nfunc Path(path string) func(*http.Cookie)\n```\nPath sets the path for a provided cookie\n\n```go\nfunc SameSite(sameSite http.SameSite) func(*http.Cookie)\n```\nSameSite sets the SameSite for a provided cookie\n\n```go\nfunc Secure(secure bool) func(*http.Cookie)\n```\nSecure sets the secure setting for a provided cookie\n\n```go\nfunc SetCookie(resp http.ResponseWriter, name string, value string, others ...interface{})\n```\nSetCookie set the cookies TODO: Copied from gitea.com/macaron/macaron and should be improved after macaron removed.\n\n```go\nfunc SetLocaleCookie(resp http.ResponseWriter, lang string, expiry int)\n```\nSetLocaleCookie convenience function to set the locale cookie consistently\n\n```go\nfunc SetRedirectToCookie(resp http.ResponseWriter, value string)\n```\nSetRedirectToCookie convenience function to set the RedirectTo cookie consistently\n\n```go\nfunc Validate(errs binding.Errors, data map[string]interface{}, f Form, l translation.Locale) binding.Errors\n```\nValidate validate TODO:\n\n## Types\n\n```go\ntype DataStore interface {\n\tGetData() map[string]interface{}\n}\n```\nDataStore represents a data store\n\n```go\ntype Flash struct {\n\tDataStore\n\turl.Values\n\tErrorMsg, WarningMsg, InfoMsg, SuccessMsg string\n}\n```\nFlash represents a one time data transfer between two requests.\n\n```go\nfunc (f *Flash) Error(msg string, current ...bool)\n```\nError sets error message\n\n```go\nfunc (f *Flash) Info(msg string, current ...bool)\n```\nInfo sets info message\n\n```go\nfunc (f *Flash) Success(msg string, current ...bool)\n```\nSuccess sets success message\n\n```go\nfunc (f *Flash) Warning(msg string, current ...bool)\n```\nWarning sets warning message\n\n```go\ntype Form interface {\n\tbinding.Validator\n}\n```\nForm form binding interface\n\n","path":"github.com/RedAFD/code-core/modules/web/middleware","name":"middleware","synopsis":"","isRedistributable":true}
