Versions in this module Expand all Collapse all v1 v1.0.0 Feb 22, 2022 Changes in this version + const AfterExec + const BeforeExec + const BeforeRouter + const BeforeStatic + const DEV + const FinishRouter + const PROD + var AppConfig *beegoAppConfig + var AppPath string + var BConfig *Config + var ErrAbort = errors.New("user stop run") + var ErrorMaps = make(map[string]*errorInfo, 10) + var FilterMonitorFunc func(string, string, time.Duration, string, int) bool + var GlobalControllerRouter = make(map[string][]ControllerComments) + var GlobalSessions *session.Manager + var WorkPath string + func AddAPPStartHook(hf ...hookfunc) + func AddFuncMap(key string, fn interface{}) error + func AddNamespace(nl ...*Namespace) + func AddTemplateExt(ext string) + func AddViewPath(viewPath string) error + func AssetsCSS(text string) template.HTML + func AssetsJs(text string) template.HTML + func BuildTemplate(dir string, files ...string) error + func Compare(a, b interface{}) (equal bool) + func CompareNot(a, b interface{}) (equal bool) + func CtrlAny(rootpath string, f interface{}) + func CtrlDelete(rootpath string, f interface{}) + func CtrlGet(rootpath string, f interface{}) + func CtrlHead(rootpath string, f interface{}) + func CtrlOptions(rootpath string, f interface{}) + func CtrlPatch(rootpath string, f interface{}) + func CtrlPost(rootpath string, f interface{}) + func CtrlPut(rootpath string, f interface{}) + func Date(t time.Time, format string) string + func DateFormat(t time.Time, layout string) (datestring string) + func DateParse(dateString, format string) (time.Time, error) + func ExceptMethodAppend(action string) + func Exception(errCode uint64, ctx *context.Context) + func ExecuteTemplate(wr io.Writer, name string, data interface{}) error + func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, data interface{}) error + func GetConfig(returnType, key string, defaultVal interface{}) (value interface{}, err error) + func HTML2str(html string) string + func HasTemplateExt(paths string) bool + func Htmlquote(text string) string + func Htmlunquote(text string) string + func InitBeegoBeforeTest(appConfigPath string) + func LoadAppConfig(adapterName, configPath string) error + func LogAccess(ctx *beecontext.Context, startTime *time.Time, statusCode int) + func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error) + func NotNil(a interface{}) (isNil bool) + func ParseForm(form url.Values, obj interface{}) error + func Policy(pattern, method string, policy ...PolicyFunc) + func RenderForm(obj interface{}) template.HTML + func Run(params ...string) + func RunWithMiddleWares(addr string, mws ...MiddleWare) + func SetTemplateFSFunc(fnt templateFSFunc) + func Str2html(raw string) template.HTML + func Substr(s string, start, length int) string + func TestBeegoInit(ap string) + func URLFor(endpoint string, values ...interface{}) string + func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error + type Config struct + AppName string + CopyRequestBody bool + EnableErrorsRender bool + EnableErrorsShow bool + EnableGzip bool + Listen Listen + Log LogConfig + MaxMemory int64 + MaxUploadSize int64 + RecoverFunc func(*context.Context, *Config) + RecoverPanic bool + RouterCaseSensitive bool + RunMode string + ServerName string + WebConfig WebConfig + type Controller struct + AppController interface{} + CruSession session.Store + Ctx *context.Context + Data map[interface{}]interface{} + EnableRender bool + EnableXSRF bool + Layout string + LayoutSections map[string]string + TplExt string + TplName string + TplPrefix string + ViewPath string + XSRFExpire int + func (c *Controller) Abort(code string) + func (c *Controller) Bind(obj interface{}) error + func (c *Controller) BindForm(obj interface{}) error + func (c *Controller) BindJSON(obj interface{}) error + func (c *Controller) BindProtobuf(obj proto.Message) error + func (c *Controller) BindXML(obj interface{}) error + func (c *Controller) BindYAML(obj interface{}) error + func (c *Controller) CheckXSRFCookie() bool + func (c *Controller) CustomAbort(status int, body string) + func (c *Controller) DelSession(name interface{}) error + func (c *Controller) Delete() + func (c *Controller) DestroySession() error + func (c *Controller) Finish() + func (c *Controller) Get() + func (c *Controller) GetBool(key string, def ...bool) (bool, error) + func (c *Controller) GetControllerAndAction() (string, string) + func (c *Controller) GetFile(key string) (multipart.File, *multipart.FileHeader, error) + func (c *Controller) GetFiles(key string) ([]*multipart.FileHeader, error) + func (c *Controller) GetFloat(key string, def ...float64) (float64, error) + func (c *Controller) GetInt(key string, def ...int) (int, error) + func (c *Controller) GetInt16(key string, def ...int16) (int16, error) + func (c *Controller) GetInt32(key string, def ...int32) (int32, error) + func (c *Controller) GetInt64(key string, def ...int64) (int64, error) + func (c *Controller) GetInt8(key string, def ...int8) (int8, error) + func (c *Controller) GetSecureCookie(Secret, key string) (string, bool) + func (c *Controller) GetSession(name interface{}) interface{} + func (c *Controller) GetString(key string, def ...string) string + func (c *Controller) GetStrings(key string, def ...[]string) []string + func (c *Controller) GetUint16(key string, def ...uint16) (uint16, error) + func (c *Controller) GetUint32(key string, def ...uint32) (uint32, error) + func (c *Controller) GetUint64(key string, def ...uint64) (uint64, error) + func (c *Controller) GetUint8(key string, def ...uint8) (uint8, error) + func (c *Controller) HandlerFunc(fnname string) bool + func (c *Controller) Head() + func (c *Controller) Init(ctx *context.Context, controllerName, actionName string, app interface{}) + func (c *Controller) Input() (url.Values, error) + func (c *Controller) IsAjax() bool + func (c *Controller) JSONResp(data interface{}) error + func (c *Controller) Mapping(method string, fn func()) + func (c *Controller) Options() + func (c *Controller) ParseForm(obj interface{}) error + func (c *Controller) Patch() + func (c *Controller) Post() + func (c *Controller) Prepare() + func (c *Controller) Put() + func (c *Controller) Redirect(url string, code int) + func (c *Controller) Render() error + func (c *Controller) RenderBytes() ([]byte, error) + func (c *Controller) RenderString() (string, error) + func (c *Controller) Resp(data interface{}) error + func (c *Controller) SaveToFile(fromFile, toFile string) error + func (c *Controller) SaveToFileWithBuffer(fromFile string, toFile string, buf []byte) error + func (c *Controller) ServeFormatted(encoding ...bool) error + func (c *Controller) ServeJSON(encoding ...bool) error + func (c *Controller) ServeJSONP() error + func (c *Controller) ServeXML() error + func (c *Controller) ServeYAML() error + func (c *Controller) SessionRegenerateID() error + func (c *Controller) SetData(data interface{}) + func (c *Controller) SetSecureCookie(Secret, name, value string, others ...interface{}) + func (c *Controller) SetSession(name interface{}, value interface{}) error + func (c *Controller) StartSession() session.Store + func (c *Controller) StopRun() + func (c *Controller) Trace() + func (c *Controller) URLFor(endpoint string, values ...interface{}) string + func (c *Controller) URLMapping() + func (c *Controller) XMLResp(data interface{}) error + func (c *Controller) XSRFFormHTML() string + func (c *Controller) XSRFToken() string + func (c *Controller) YamlResp(data interface{}) error + type ControllerComments struct + AllowHTTPMethods []string + FilterComments []*ControllerFilterComments + Filters []*ControllerFilter + ImportComments []*ControllerImportComments + Method string + MethodParams []*param.MethodParam + Params []map[string]string + Router string + type ControllerCommentsSlice []ControllerComments + func (p ControllerCommentsSlice) Len() int + func (p ControllerCommentsSlice) Less(i, j int) bool + func (p ControllerCommentsSlice) Swap(i, j int) + type ControllerFilter struct + Filter FilterFunc + Pattern string + Pos int + ResetParams bool + ReturnOnOutput bool + type ControllerFilterComments struct + Filter string + Pattern string + Pos int + ResetParams bool + ReturnOnOutput bool + type ControllerImportComments struct + ImportAlias string + ImportPath string + type ControllerInfo struct + func (c *ControllerInfo) GetPattern() string + type ControllerInterface interface + CheckXSRFCookie func() bool + Delete func() + Finish func() + Get func() + HandlerFunc func(fn string) bool + Head func() + Init func(ct *context.Context, controllerName, actionName string, app interface{}) + Options func() + Patch func() + Post func() + Prepare func() + Put func() + Render func() error + Trace func() + URLMapping func() + XSRFToken func() string + type ControllerOption func(*ControllerInfo) + func WithRouterMethods(ctrlInterface ControllerInterface, mappingMethod ...string) ControllerOption + func WithRouterSessionOn(sessionOn bool) ControllerOption + type ControllerRegister struct + func NewControllerRegister() *ControllerRegister + func NewControllerRegisterWithCfg(cfg *Config) *ControllerRegister + func (p *ControllerRegister) Add(pattern string, c ControllerInterface, opts ...ControllerOption) + func (p *ControllerRegister) AddAuto(c ControllerInterface) + func (p *ControllerRegister) AddAutoPrefix(prefix string, c ControllerInterface) + func (p *ControllerRegister) AddMethod(method, pattern string, f HandleFunc) + func (p *ControllerRegister) AddRouterMethod(httpMethod, pattern string, f interface{}) + func (p *ControllerRegister) Any(pattern string, f HandleFunc) + func (p *ControllerRegister) CtrlAny(pattern string, f interface{}) + func (p *ControllerRegister) CtrlDelete(pattern string, f interface{}) + func (p *ControllerRegister) CtrlGet(pattern string, f interface{}) + func (p *ControllerRegister) CtrlHead(pattern string, f interface{}) + func (p *ControllerRegister) CtrlOptions(pattern string, f interface{}) + func (p *ControllerRegister) CtrlPatch(pattern string, f interface{}) + func (p *ControllerRegister) CtrlPost(pattern string, f interface{}) + func (p *ControllerRegister) CtrlPut(pattern string, f interface{}) + func (p *ControllerRegister) Delete(pattern string, f HandleFunc) + func (p *ControllerRegister) FindPolicy(cont *context.Context) []PolicyFunc + func (p *ControllerRegister) FindRouter(context *beecontext.Context) (routerInfo *ControllerInfo, isFind bool) + func (p *ControllerRegister) Get(pattern string, f HandleFunc) + func (p *ControllerRegister) GetContext() *beecontext.Context + func (p *ControllerRegister) GiveBackContext(ctx *beecontext.Context) + func (p *ControllerRegister) Handler(pattern string, h http.Handler, options ...interface{}) + func (p *ControllerRegister) Head(pattern string, f HandleFunc) + func (p *ControllerRegister) Include(cList ...ControllerInterface) + func (p *ControllerRegister) Init() + func (p *ControllerRegister) InsertFilter(pattern string, pos int, filter FilterFunc, opts ...FilterOpt) error + func (p *ControllerRegister) InsertFilterChain(pattern string, chain FilterChain, opts ...FilterOpt) + func (p *ControllerRegister) Options(pattern string, f HandleFunc) + func (p *ControllerRegister) Patch(pattern string, f HandleFunc) + func (p *ControllerRegister) Post(pattern string, f HandleFunc) + func (p *ControllerRegister) Put(pattern string, f HandleFunc) + func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request) + func (p *ControllerRegister) URLFor(endpoint string, values ...interface{}) string + type FileSystem struct + func (d FileSystem) Open(name string) (http.File, error) + type FilterChain func(next FilterFunc) FilterFunc + type FilterFunc = HandleFunc + type FilterHandler interface + Filter func(*beecontext.Context) bool + var DefaultAccessLogFilter FilterHandler = &logFilter{} + var HTTPMETHOD = map[string]bool{ ... } + type FilterOpt func(opts *filterOpts) + func WithCaseSensitive(sensitive bool) FilterOpt + func WithResetParams(reset bool) FilterOpt + func WithReturnOnOutput(ret bool) FilterOpt + type FilterRouter struct + func (f *FilterRouter) ValidRouter(url string, ctx *context.Context) bool + type FlashData struct + Data map[string]string + func NewFlash() *FlashData + func ReadFromRequest(c *Controller) *FlashData + func (fd *FlashData) Error(msg string, args ...interface{}) + func (fd *FlashData) Notice(msg string, args ...interface{}) + func (fd *FlashData) Set(key string, msg string, args ...interface{}) + func (fd *FlashData) Store(c *Controller) + func (fd *FlashData) Success(msg string, args ...interface{}) + func (fd *FlashData) Warning(msg string, args ...interface{}) + type HandleFunc func(ctx *beecontext.Context) + type HttpServer struct + Cfg *Config + Handlers *ControllerRegister + Server *http.Server + var BeeApp *HttpServer + func AddTemplateEngine(extension string, fn templatePreProcessor) *HttpServer + func Any(rootpath string, f HandleFunc) *HttpServer + func AutoPrefix(prefix string, c ControllerInterface) *HttpServer + func AutoRouter(c ControllerInterface) *HttpServer + func DelStaticPath(url string) *HttpServer + func Delete(rootpath string, f HandleFunc) *HttpServer + func ErrorController(c ControllerInterface) *HttpServer + func ErrorHandler(code string, h http.HandlerFunc) *HttpServer + func Get(rootpath string, f HandleFunc) *HttpServer + func Handler(rootpath string, h http.Handler, options ...interface{}) *HttpServer + func Head(rootpath string, f HandleFunc) *HttpServer + func Include(cList ...ControllerInterface) *HttpServer + func InsertFilter(pattern string, pos int, filter FilterFunc, opts ...FilterOpt) *HttpServer + func InsertFilterChain(pattern string, filterChain FilterChain, opts ...FilterOpt) *HttpServer + func NewHttpServerWithCfg(cfg *Config) *HttpServer + func NewHttpSever() *HttpServer + func Options(rootpath string, f HandleFunc) *HttpServer + func Patch(rootpath string, f HandleFunc) *HttpServer + func Post(rootpath string, f HandleFunc) *HttpServer + func Put(rootpath string, f HandleFunc) *HttpServer + func RESTRouter(rootpath string, c ControllerInterface) *HttpServer + func Router(rootpath string, c ControllerInterface, mappingMethods ...string) *HttpServer + func RouterWithOpts(rootpath string, c ControllerInterface, opts ...ControllerOption) *HttpServer + func SetStaticPath(url string, path string) *HttpServer + func SetViewsPath(path string) *HttpServer + func UnregisterFixedRoute(fixedRoute string, method string) *HttpServer + func (app *HttpServer) Any(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) AutoPrefix(prefix string, c ControllerInterface) *HttpServer + func (app *HttpServer) AutoRouter(c ControllerInterface) *HttpServer + func (app *HttpServer) CtrlAny(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlDelete(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlGet(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlHead(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlOptions(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlPatch(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlPost(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) CtrlPut(rootpath string, f interface{}) *HttpServer + func (app *HttpServer) Delete(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) Get(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) Handler(rootpath string, h http.Handler, options ...interface{}) *HttpServer + func (app *HttpServer) Head(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) Include(cList ...ControllerInterface) *HttpServer + func (app *HttpServer) InsertFilter(pattern string, pos int, filter FilterFunc, opts ...FilterOpt) *HttpServer + func (app *HttpServer) InsertFilterChain(pattern string, filterChain FilterChain, opts ...FilterOpt) *HttpServer + func (app *HttpServer) LogAccess(ctx *beecontext.Context, startTime *time.Time, statusCode int) + func (app *HttpServer) Options(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) Patch(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) Post(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) PrintTree() M + func (app *HttpServer) Put(rootpath string, f HandleFunc) *HttpServer + func (app *HttpServer) RESTRouter(rootpath string, c ControllerInterface) *HttpServer + func (app *HttpServer) Router(rootPath string, c ControllerInterface, mappingMethods ...string) *HttpServer + func (app *HttpServer) RouterWithOpts(rootPath string, c ControllerInterface, opts ...ControllerOption) *HttpServer + func (app *HttpServer) Run(addr string, mws ...MiddleWare) + func (app *HttpServer) UnregisterFixedRoute(fixedRoute string, method string) *HttpServer + type LinkNamespace func(*Namespace) + func NSAfter(filterList ...FilterFunc) LinkNamespace + func NSAny(rootpath string, f HandleFunc) LinkNamespace + func NSAutoPrefix(prefix string, c ControllerInterface) LinkNamespace + func NSAutoRouter(c ControllerInterface) LinkNamespace + func NSBefore(filterList ...FilterFunc) LinkNamespace + func NSCond(cond namespaceCond) LinkNamespace + func NSCtrlAny(rootpath string, f interface{}) LinkNamespace + func NSCtrlDelete(rootpath string, f interface{}) LinkNamespace + func NSCtrlGet(rootpath string, f interface{}) LinkNamespace + func NSCtrlHead(rootpath string, f interface{}) LinkNamespace + func NSCtrlOptions(rootpath string, f interface{}) LinkNamespace + func NSCtrlPatch(rootpath string, f interface{}) LinkNamespace + func NSCtrlPost(rootpath string, f interface{}) LinkNamespace + func NSCtrlPut(rootpath string, f interface{}) LinkNamespace + func NSDelete(rootpath string, f HandleFunc) LinkNamespace + func NSGet(rootpath string, f HandleFunc) LinkNamespace + func NSHandler(rootpath string, h http.Handler) LinkNamespace + func NSHead(rootpath string, f HandleFunc) LinkNamespace + func NSInclude(cList ...ControllerInterface) LinkNamespace + func NSNamespace(prefix string, params ...LinkNamespace) LinkNamespace + func NSOptions(rootpath string, f HandleFunc) LinkNamespace + func NSPatch(rootpath string, f HandleFunc) LinkNamespace + func NSPost(rootpath string, f HandleFunc) LinkNamespace + func NSPut(rootpath string, f HandleFunc) LinkNamespace + func NSRouter(rootpath string, c ControllerInterface, mappingMethods ...string) LinkNamespace + type Listen struct + AdminAddr string + AdminPort int + AutoTLS bool + ClientAuth int + Domains []string + EnableAdmin bool + EnableFcgi bool + EnableHTTP bool + EnableHTTPS bool + EnableMutualHTTPS bool + EnableStdIo bool + Graceful bool + HTTPAddr string + HTTPPort int + HTTPSAddr string + HTTPSCertFile string + HTTPSKeyFile string + HTTPSPort int + ListenTCP4 bool + ServerTimeOut int64 + TLSCacheDir string + TrustCaFile string + type LogConfig struct + AccessLogs bool + AccessLogsFormat string + EnableStaticLogs bool + FileLineNum bool + Outputs map[string]string + type M map[string]interface + func PrintTree() M + type MiddleWare func(http.Handler) http.Handler + type Namespace struct + func NewNamespace(prefix string, params ...LinkNamespace) *Namespace + func (n *Namespace) Any(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) AutoPrefix(prefix string, c ControllerInterface) *Namespace + func (n *Namespace) AutoRouter(c ControllerInterface) *Namespace + func (n *Namespace) Cond(cond namespaceCond) *Namespace + func (n *Namespace) CtrlAny(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlDelete(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlGet(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlHead(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlOptions(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlPatch(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlPost(rootpath string, f interface{}) *Namespace + func (n *Namespace) CtrlPut(rootpath string, f interface{}) *Namespace + func (n *Namespace) Delete(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Filter(action string, filter ...FilterFunc) *Namespace + func (n *Namespace) Get(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Handler(rootpath string, h http.Handler) *Namespace + func (n *Namespace) Head(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Include(cList ...ControllerInterface) *Namespace + func (n *Namespace) Namespace(ns ...*Namespace) *Namespace + func (n *Namespace) Options(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Patch(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Post(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Put(rootpath string, f HandleFunc) *Namespace + func (n *Namespace) Router(rootpath string, c ControllerInterface, mappingMethods ...string) *Namespace + type PolicyFunc func(*context.Context) + type SessionConfig struct + SessionAutoSetCookie bool + SessionCookieLifeTime int + SessionCookieSameSite http.SameSite + SessionDisableHTTPOnly bool + SessionDomain string + SessionEnableSidInHTTPHeader bool + SessionEnableSidInURLQuery bool + SessionGCMaxLifetime int64 + SessionIDPrefix string + SessionName string + SessionNameInHTTPHeader string + SessionOn bool + SessionProvider string + SessionProviderConfig string + type Statistics struct + MaxTime time.Duration + MinTime time.Duration + RequestController string + RequestNum int64 + RequestURL string + TotalTime time.Duration + type Tree struct + func NewTree() *Tree + func (t *Tree) AddRouter(pattern string, runObject interface{}) + func (t *Tree) AddTree(prefix string, tree *Tree) + func (t *Tree) Match(pattern string, ctx *context.Context) (runObject interface{}) + type URLMap struct + LengthLimit int + var StatisticsMap *URLMap + func (m *URLMap) AddStatistics(requestMethod, requestURL, requestController string, requesttime time.Duration) + func (m *URLMap) GetMap() map[string]interface{} + func (m *URLMap) GetMapData() []map[string]interface{} + type WebConfig struct + AutoRender bool + CommentRouterPath string + DirectoryIndex bool + EnableDocs bool + EnableXSRF bool + FlashName string + FlashSeparator string + Session SessionConfig + StaticCacheFileNum int + StaticCacheFileSize int + StaticDir map[string]string + StaticExtensionsToGzip []string + TemplateLeft string + TemplateRight string + ViewsPath string + XSRFExpire int + XSRFKey string Other modules containing this package github.com/whiliang/beego-multi-schema/v2