# Packages
Package captcha implements generation and verification of image CAPTCHAs.
Package context provide the context utils Usage:
import "github.com/beego/beego/v2/server/web/context"
ctx := context.Context{Request:req,ResponseWriter:rw}
more docs http://beego.me/docs/module/context.md.
No description provided by the author
Package grace use to hot reload Description: http://grisha.org/blog/2014/06/03/graceful-restart-in-golang/
Usage:
import( "log" "net/http" "os"
"github.com/beego/beego/v2/server/web/grace" )
func handler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("WORLD!")) }
func main() { mux := http.NewServeMux() mux.HandleFunc("/hello", handler)
err := grace.ListenAndServe("localhost:8080", mux) if err != nil { log.Println(err) } log.Println("Server on 8080 stopped") os.Exit(0) }.
No description provided by the author
No description provided by the author
Package session provider
Usage: import( "github.com/beego/beego/v2/server/web/session" )
func init() { globalSessions, _ = session.NewManager("memory", `{"cookieName":"gosessionid", "enableSetCookie,omitempty": true, "gclifetime":3600, "maxLifetime": 3600, "secure": false, "cookieLifeTime": 3600, "providerConfig": ""}`) go globalSessions.GC() }
more docs: http://beego.me/docs/module/session.md.
Package swagger struct definition.
# Functions
AddAPPStartHook is used to register the hookfunc The hookfuncs will run in beego.Run() such as initiating session , starting middleware , building template, starting admin control and so on.
AddFuncMap let user to register a func in the template.
AddNamespace register Namespace into beego.Handler support multi Namespace.
AddTemplateEngine add a new templatePreProcessor which support extension.
AddTemplateExt add new extension for template.
AddViewPath adds a new path to the supported view paths.
Any see HttpServer.Any.
AssetsCSS returns stylesheet link tag with src string.
AssetsJs returns script tag with src string.
AutoPrefix see HttpServer.AutoPrefix.
AutoRouter see HttpServer.AutoRouter.
BuildTemplate will build all template files in a directory.
Compare is a quick and dirty comparison function.
CompareNot !Compare.
Date takes a PHP like date func to Go's time format.
DateFormat takes a time and a layout string and returns a string with the formatted date.
DateParse Parse Date use PHP time format.
Delete see HttpServer.Delete.
DelStaticPath removes the static folder setting in this url pattern in beego application.
ErrorController registers ControllerInterface to each http err code string.
ErrorHandler registers http.HandlerFunc to each http err code string.
Exception Write HttpStatus with errCode and Exec error handler if exist.
ExceptMethodAppend to append a slice's value into "exceptMethod", for controller's methods shouldn't reflect to AutoRouter.
ExecuteTemplate applies the template with name to the specified data object, writing the output to wr.
ExecuteViewPathTemplate applies the template with name and from specific viewPath to the specified data object, writing the output to wr.
Get see HttpServer.Get.
GetConfig get the Appconfig.
Handler see HttpServer.Handler.
HasTemplateExt return this path contains supported template extension of beego or not.
Head see HttpServer.Head.
HTML2str returns escaping text convert from html.
Htmlquote returns quoted html string.
Htmlunquote returns unquoted html string.
Include see HttpServer.Include.
InitBeegoBeforeTest is for test package init.
InserFilter see HttpServer.InsertFilter.
InsertFilterChain see HttpServer.InsertFilterChain.
LoadAppConfig allow developer to apply a config file.
LogAccess logging info HTTP Access.
MapGet getting value from map by keys usage: Data["m"] = M{ "a": 1, "1": map[string]float64{ "c": 4, }, }
{{ map_get m "a" }} // return 1 {{ map_get m 1 "c" }} // return 4.
NewControllerRegister returns a new ControllerRegister.
No description provided by the author
NewFlash return a new empty FlashData struct.
NewHttpServerWithCfg will create an sever with specific cfg.
NewHttpSever returns a new beego application.
NewNamespace get new Namespace.
NewTree return a new Tree.
NotNil the same as CompareNot.
NSAfter add Namespace FinishRouter filter.
NSAny call Namespace Any.
NSAutoPrefix call Namespace AutoPrefix.
NSAutoRouter call Namespace AutoRouter.
NSBefore Namespace BeforeRouter filter.
NSCond is Namespace Condition.
NSDelete call Namespace Delete.
NSGet call Namespace Get.
NSHandler add handler.
NSHead call Namespace Head.
NSInclude Namespace Include ControllerInterface.
NSNamespace add sub Namespace.
NSOptions call Namespace Options.
NSPatch call Namespace Patch.
NSPost call Namespace Post.
NSPut call Namespace Put.
NSRouter call Namespace Router.
NSRouterAny call Namespace RouterAny.
NSRouterDelete call Namespace RouterDelete.
NSRouterGet call Namespace RouterGet.
NSRouterHead call Namespace RouterHead.
NSRouterOptions call Namespace RouterOptions.
NSRouterPatch call Namespace RouterPatch.
NSRouterPost call Namespace RouterPost.
NSRouterPut call Namespace RouterPut.
Options see HttpServer.Options.
ParseForm will parse form values to struct via tag.
Patch see HttpServer.Patch.
Policy Register new policy in beego.
Post see HttpServer.Post.
PrintTree print all routers Deprecated using BeeApp directly.
Put see HttpServer.Put.
ReadFromRequest parsed flash data from encoded values in cookie.
RenderForm will render object to form html.
RESTRouter see HttpServer.RESTRouter.
Router see HttpServer.Router.
RouterAny see HttpServer.RouterAny.
RouterDelete see HttpServer.RouterDelete.
RouterGet see HttpServer.RouterGet.
RouterHead see HttpServer.RouterHead.
RouterOptions see HttpServer.RouterOptions.
RouterPatch see HttpServer.RouterPatch.
RouterPost see HttpServer.RouterGet.
RouterPut see HttpServer.RouterPut.
No description provided by the author
Run beego application.
RunWithMiddleWares Run beego application with middlewares.
SetStaticPath sets static directory path and proper url pattern in beego application.
SetTemplateFSFunc set default filesystem function.
SetViewsPath sets view directory path in beego application.
Str2html Convert string to template.HTML type.
Substr returns the substr from start to length.
TestBeegoInit is for test package init.
UnregisterFixedRoute see HttpServer.UnregisterFixedRoute.
URLFor returns url string with another registered controller handler with params.
Walk walks the file tree rooted at root in filesystem, calling walkFn for each file or directory in the tree, including root.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
default filter execution points.
default filter execution points.
default filter execution points.
default filter execution points.
DEV is for develop.
default filter execution points.
PROD is for production.
# Variables
AppConfig is the instance of Config, store the config information from file.
AppPath is the absolute path to the app.
BConfig is the default config for Application.
BeeApp is an application instance If you are using single server, you could use this But if you need multiple servers, do not use this.
DefaultAccessLogFilter will skip the accesslog if return true.
ErrAbort custom error when user stop request handler manually.
ErrorMaps holds map of http handlers for each error string.
FilterMonitorFunc is default monitor filter when admin module is enable.
GlobalControllerRouter store comments with controller.
GlobalSessions is the instance for the session manager.
HTTPMETHOD list the supported http methods.
StatisticsMap hosld global statistics data map.
WorkPath is the absolute path to project root directory.
# Structs
Config is the main struct for BConfig TODO after supporting multiple servers, remove common config to somewhere else.
Controller defines some basic http request handler operations, such as http context, template and view, session and xsrf.
ControllerComments store the comment for the controller method.
ControllerFilter store the filter for controller.
ControllerFilterComments store the comment for controller level filter.
ControllerImportComments store the import comment for controller needed.
ControllerInfo holds information about the controller.
ControllerRegister containers registered router rules, controller handlers and filters.
No description provided by the author
FilterRouter defines a filter operation which is invoked before the controller handler is executed.
FlashData is a tools to maintain data when using across request.
HttpServer defines beego application with a new PatternServeMux.
Listen holds for http and https related config.
LogConfig holds Log related config.
Namespace is store all the info.
SessionConfig holds session related config.
Statistics struct.
Tree has three elements: FixRouter/wildcard/leaves fixRouter stores Fixed Router wildcard stores params leaves store the endpoint information.
URLMap contains several statistics struct to log different data.
WebConfig holds web related config.
# Interfaces
ControllerInterface is an interface to uniform all controller handler.
FilterHandler is an interface for.
# Type aliases
ControllerCommentsSlice implements the sort interface.
No description provided by the author
FilterChain is different from pure FilterFunc when you use this, you must invoke next(ctx) inside the FilterFunc which is returned And all those FilterChain will be invoked before other FilterFunc.
FilterFunc defines a filter function which is invoked before the controller handler is executed.
No description provided by the author
LinkNamespace used as link action.
M is Map shortcut.
MiddleWare function for http.Handler.
PolicyFunc defines a policy function which is invoked before the controller handler is executed.