Versions in this module Expand all Collapse all v0 v0.7.0 Jun 1, 2016 Changes in this version + const BIZ_HANDLER_DIR + const BIZ_MODEL_DIR + const BIZ_VIEW_DIR + const HeaderXCSRFToken + const LOG_FILE + const ROUTERCONFIG_FILE + const ROUTER_DIR + const SYS_HANDLER_DIR + const SYS_MODEL_DIR + const SYS_VIEW_DIR + var AutoHTMLSuffix = ...() + var ErrStatusInternalServerError = NewHTTPError(http.StatusInternalServerError) + var FilterTemplate = ...() + var Log = func() logs.Logger { ... }() + func CleanPath(p string) string + func Debug() bool + func File(path, file string, middlewares ...interface{}) error + func MemoryCacheEnable() bool + func ReadSingleConfig(section string, p interface{}, iniconf confpkg.Configer) + func ResetAfter() + func ResetBefore() + func ResetFiles() + func ResetStatics() + func SetBinder(b Binder) + func SetDebug(on bool) + func SetInternalServerError(fn func(c *Context, err error, rcv interface{})) + func SetMemoryCache(m *MemoryCache) + func SetMethodNotAllowed(fn func(*Context) error) + func SetNotFound(fn func(*Context) error) + func SetRenderer(r Renderer) + func Static(prefix, root string, middlewares ...interface{}) error + func WriteSingleConfig(section string, p interface{}, iniconf confpkg.Configer) type ApiMiddleware + Config interface{} + func (a *ApiMiddleware) ConfigJSON() string + func (a *ApiMiddleware) NewMiddlewareConfig() *MiddlewareConfig + func (a *ApiMiddleware) SetConfig(confObject interface{}) *ApiMiddleware + type App struct + func (this *App) Debug() bool + func (this *App) Log() logs.Logger + func (this *App) MemoryCacheEnable() bool + func (this *App) RealRoutes() []Route + func (this *App) ServeHTTP(rw http.ResponseWriter, req *http.Request) + func (this *App) Sessions() *session.Manager + func (this *App) SetBinder(b Binder) + func (this *App) SetDebug(on bool) + func (this *App) SetInternalServerError(fn func(*Context, error, interface{})) + func (this *App) SetMemoryCache(m *MemoryCache) + func (this *App) SetMethodNotAllowed(fn func(*Context) error) + func (this *App) SetNotFound(fn func(*Context) error) + func (this *App) SetRenderer(r Renderer) type Context + func (c *Context) Contains(key string) bool + func (c *Context) IsTLS() bool + func (c *Context) Log() logs.Logger + func (c *Context) RealRemoteAddr() string + func (c *Context) Scheme() string + func (c *Context) SetRequestBody(reader io.Reader) type Lessgo + func (this Lessgo) LoadMainConfig(fname string) (err error) type MiddlewareConfig + func WrapMiddlewareConfigs(middlewares []interface{}) ([]*MiddlewareConfig, error) + func (m *MiddlewareConfig) CheckDynamic() bool + func (m *MiddlewareConfig) CheckValid() bool + func (m *MiddlewareConfig) GetConfig() string + func (m *MiddlewareConfig) SetConfig(configJSONBytes []byte) error type Route + func RealRoutes() []Route type Router + ErrorPanicHandler func(*Context, error, interface{}) + HandleMethodNotAllowed bool + HandleOPTIONS bool + MethodNotAllowed HandlerFunc + NotFound HandlerFunc + RedirectFixedPath bool + RedirectTrailingSlash bool + func (r *Router) Handle(method, path string, handle HandlerFunc) + type VirtFile struct + File string + Middlewares []*MiddlewareConfig + Path string + func VirtFiles() []*VirtFile type VirtRouter + func VirtRoutes() []*VirtRouter + type VirtStatic struct + Middlewares []*MiddlewareConfig + Prefix string + Root string + func VirtStatics() []*VirtStatic v0.6.0 May 17, 2016 Changes in this version + const ADDRESS + const ANY + const APPCONFIG_FILE + const BUSINESS_API_DIR + const BUSINESS_VIEW_DIR + const COMMON_DIR + const CONFIG_DIR + const CONNECT + const CSS_DIR + const DBCONFIG_FILE + const DB_DIR + const DEFAULTDB_SECTION + const DELETE + const GET + const GROUP + const HANDLER + const HEAD + const HeaderAcceptEncoding + const HeaderAccessControlAllowCredentials + const HeaderAccessControlAllowHeaders + const HeaderAccessControlAllowMethods + const HeaderAccessControlAllowOrigin + const HeaderAccessControlExposeHeaders + const HeaderAccessControlMaxAge + const HeaderAccessControlRequestHeaders + const HeaderAccessControlRequestMethod + const HeaderAuthorization + const HeaderContentDisposition + const HeaderContentEncoding + const HeaderContentLength + const HeaderContentSecurityPolicy + const HeaderContentType + const HeaderCookie + const HeaderIfModifiedSince + const HeaderLastModified + const HeaderLocation + const HeaderOrigin + const HeaderServer + const HeaderSetCookie + const HeaderStrictTransportSecurity + const HeaderUpgrade + const HeaderVary + const HeaderWWWAuthenticate + const HeaderXContentTypeOptions + const HeaderXForwardedFor + const HeaderXForwardedProto + const HeaderXFrameOptions + const HeaderXHTTPMethodOverride + const HeaderXRealIP + const HeaderXXSSProtection + const IMG_DIR + const JS_DIR + const MB + const MIDDLEWARE_DIR + const MIMEApplicationForm + const MIMEApplicationJSON + const MIMEApplicationJSONCharsetUTF8 + const MIMEApplicationJavaScript + const MIMEApplicationJavaScriptCharsetUTF8 + const MIMEApplicationMsgpack + const MIMEApplicationProtobuf + const MIMEApplicationXML + const MIMEApplicationXMLCharsetUTF8 + const MIMEMultipartForm + const MIMEOctetStream + const MIMETextHTML + const MIMETextHTMLCharsetUTF8 + const MIMETextPlain + const MIMETextPlainCharsetUTF8 + const MODULE_SUFFIX + const NAME + const OPTIONS + const PATCH + const PLUGIN_DIR + const POST + const PUT + const ROOT + const STATIC_DIR + const STATIC_HTML_EXT + const SYSTEM_API_DIR + const SYSTEM_VIEW_DIR + const TPL_DIR + const TPL_EXT + const TRACE + const UPLOADS_DIR + const VERSION + const VIEW_PKG + const WS + var AppConfig = initConfig() + var DefLessgo = newLessgo() + var ErrCookieNotFound = errors.New("cookie not found") + var ErrInvalidRedirectCode = errors.New("invalid redirect status code") + var ErrMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed) + var ErrNotFound = NewHTTPError(http.StatusNotFound) + var ErrRendererNotRegistered = errors.New("renderer not registered") + var ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) + var ErrUnauthorized = NewHTTPError(http.StatusUnauthorized) + var ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) + var GlobalSessions *session.Manager + var MaxMemory int64 = 32 << 20 + var Md5 = func() string { ... }() + func AfterUse(middleware ...MiddlewareConfig) + func BeforeUse(middleware ...MiddlewareConfig) + func ContentTypeByExtension(name string) (t string) + func DefaultDB() *xorm.Engine + func DisableServer() + func EnableServer() + func GetDB(name string) (*xorm.Engine, bool) + func GetHome() string + func Lessgo() *lessgo + func LoadAppConfig() (err error) + func LoadDBConfig() (err error) + func Logger() logs.Logger + func PreUse(middleware ...MiddlewareConfig) + func ReregisterRouter() + func Root(nodes ...*VirtRouter) + func Run() + func ServerEnable() bool + func Sessions() *session.Manager + func SetHome(homeurl string) + func SimpleToken6238(secret string, length uint8, isBase32Secret bool, period uint8) *token.TOTP + func SufUse(middleware ...MiddlewareConfig) + func Token4226(secret string, length uint8, counter uint64, isBase32Secret bool) *token.HOTP + func Token6238(secret string, length uint8, isBase32Secret bool, period uint8, ...) *token.TOTP + type ApiHandler struct + Desc string + Handler func(Context) error + Method string + Params []Param + func ApiHandlerList() []*ApiHandler + func Handlers() []*ApiHandler + func NilApiHandler(desc string) *ApiHandler + func RegHandler(a ApiHandler) *ApiHandler + func (a *ApiHandler) Id() string + func (a *ApiHandler) Methods() []string + func (a *ApiHandler) Suffix() string + func (a ApiHandler) Reg() *ApiHandler + type ApiMiddleware struct + DefaultConfig interface{} + Desc string + Middleware interface{} + Name string + func Middlewares() []*ApiMiddleware + func RegMiddleware(a ApiMiddleware) *ApiMiddleware + func (a *ApiMiddleware) GetMiddlewareFunc(config string) MiddlewareFunc + func (a ApiMiddleware) CanConfig() bool + func (a ApiMiddleware) Reg() *ApiMiddleware + type Binder interface + Bind func(interface{}, Context) error + type Cachefile struct + func (c *Cachefile) Size() int64 + type CommMsg struct + Code int + Info interface{} + type ConfMiddlewareFunc func(configJSON string) MiddlewareFunc + func (c ConfMiddlewareFunc) GetMiddlewareFunc(config string) MiddlewareFunc + type Config struct + AppName string + CrossDomain bool + DBList map[string]DBConfig + Debug bool + DefaultDB string + FileCache FileCacheConfig + Info Info + Listen Listen + Log LogConfig + MaxMemoryMB int64 + RouterCaseSensitive bool + Session SessionConfig + type Context interface + App func() *Echo + Attachment func(io.ReadSeeker, string) error + Bind func(interface{}) error + Cookie func(string) (*http.Cookie, error) + Cookies func() []*http.Cookie + CruSession func() session.Store + Del func(string) + DelSession func(name interface{}) + DestroySession func() + Error func(err error) + Exists func(string) bool + File func(string) error + FormFile func(string) (*multipart.FileHeader, error) + FormParams func() map[string][]string + FormValue func(string) string + Get func(string) interface{} + GetSession func(name interface{}) interface{} + HTML func(int, string) error + Handler func() HandlerFunc + JSON func(int, interface{}) error + JSONBlob func(int, []byte) error + JSONMsg func(code int, msgcode int, info interface{}) error + JSONP func(int, string, interface{}) error + JSONPMsg func(code int, callback string, msgcode int, info interface{}) error + Logger func() logs.Logger + MultipartForm func() (*multipart.Form, error) + NetContext func() netContext.Context + NoContent func(int) error + P func(int) string + Param func(string) string + ParamNames func() []string + ParamValues func() []string + Path func() string + QueryParam func(string) string + QueryParams func() map[string][]string + Redirect func(int, string) error + Render func(int, string, interface{}) error + Request func() *Request + Response func() *Response + ServeContent func(io.ReadSeeker, string, time.Time) error + SessionRegenerateID func() + Set func(string, interface{}) + SetCookie func(*http.Cookie) + SetHandler func(HandlerFunc) + SetNetContext func(netContext.Context) + SetParam func(name, value string) + SetPath func(string) + SetSession func(name interface{}, value interface{}) + SetSocket func(*websocket.Conn) + Socket func() *websocket.Conn + String func(int, string) error + WsRecvJSON func(interface{}) error + WsRecvMsg func(*string) error + WsSendJSON func(interface{}) (int, error) + WsSendMsg func(string) (int, error) + XML func(int, interface{}) error + XMLBlob func(int, []byte) error + type DBConfig struct + ColumnFix string + ColumnSnake bool + ColumnSpace string + ConnString string + DisableCache bool + Driver string + MaxIdleConns int + MaxOpenConns int + Name string + ShowExecTime bool + ShowSql bool + TableFix string + TableSnake bool + TableSpace string + type Echo struct + func New() (e *Echo) + func (e *Echo) AddLogAdapter(adaptername string, config string) error + func (e *Echo) AfterUse(middleware ...MiddlewareFunc) + func (e *Echo) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) + func (e *Echo) BeforeUse(middleware ...MiddlewareFunc) + func (e *Echo) CaseSensitive() bool + func (e *Echo) Connect(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) Debug() bool + func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) + func (e *Echo) Delete(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) File(path, file string, middleware ...MiddlewareFunc) + func (e *Echo) Get(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) GetContext() Context + func (e *Echo) Group(prefix string, m ...MiddlewareFunc) (g *Group) + func (e *Echo) Head(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) LogFuncCallDepth(b bool) + func (e *Echo) Logger() logs.Logger + func (e *Echo) Match(methods []string, path string, handler HandlerFunc, ...) + func (e *Echo) MemoryCacheEnable() bool + func (e *Echo) NewContext(resp *Response, req *Request) Context + func (e *Echo) Options(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) Patch(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) Post(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) PreUse(middleware ...MiddlewareFunc) + func (e *Echo) Put(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) PutContext(c Context) + func (e *Echo) Router() *Router + func (e *Echo) Routes() []Route + func (e *Echo) Run(address, tlsCertfile, tlsKeyfile string, ...) + func (e *Echo) ServeHTTP(rw http.ResponseWriter, req *http.Request) + func (e *Echo) Sessions() *session.Manager + func (e *Echo) SetBinder(b Binder) + func (e *Echo) SetCaseSensitive(sensitive bool) + func (e *Echo) SetDebug(on bool) + func (e *Echo) SetHTTPErrorHandler(h HTTPErrorHandler) + func (e *Echo) SetLogLevel(l int) + func (e *Echo) SetMemoryCache(m *MemoryCache) + func (e *Echo) SetRenderer(r Renderer) + func (e *Echo) SetSessions(sessions *session.Manager) + func (e *Echo) Static(prefix, root string, middleware ...MiddlewareFunc) + func (e *Echo) SufUse(middleware ...MiddlewareFunc) + func (e *Echo) Trace(path string, h HandlerFunc, m ...MiddlewareFunc) + func (e *Echo) URI(handler HandlerFunc, params ...interface{}) string + func (e *Echo) URL(h HandlerFunc, params ...interface{}) string + func (e *Echo) WebSocket(path string, handler HandlerFunc, middleware ...MiddlewareFunc) + type FileCacheConfig struct + CacheSecond int64 + MaxCapMB int64 + SingleFileAllowMB int64 + type Group struct + func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) + func (g *Group) Connect(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Delete(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Get(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Group(prefix string, m ...MiddlewareFunc) *Group + func (g *Group) Head(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Match(methods []string, path string, handler HandlerFunc, ...) + func (g *Group) Options(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Patch(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Post(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Put(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Trace(path string, h HandlerFunc, m ...MiddlewareFunc) + func (g *Group) Use(m ...MiddlewareFunc) + type HTTPError struct + Code int + Message string + func NewHTTPError(code int, msg ...string) *HTTPError + func (e *HTTPError) Error() string + type HTTPErrorHandler func(error, Context) + type HandlerFunc func(Context) error + func StaticFunc(root string) HandlerFunc + type Info struct + Description string + Email string + License string + LicenseUrl string + TermsOfServiceUrl string + Version string + type Listen struct + Address string + EnableHTTPS bool + Graceful bool + HTTPSCertFile string + HTTPSKeyFile string + ReadTimeout int64 + WriteTimeout int64 + type LogConfig struct + AsyncChan int64 + Level int + type MemoryCache struct + func NewMemoryCache(singleFileAllow, maxCap int64, gc time.Duration) *MemoryCache + func (m *MemoryCache) Enable() bool + func (m *MemoryCache) GetCacheFile(fname string) (*bytes.Reader, os.FileInfo, bool) + func (m *MemoryCache) SetEnable(bl bool) + type Middleware interface + GetMiddlewareFunc func(config string) MiddlewareFunc + type MiddlewareConfig struct + Config string + Name string + type MiddlewareFunc func(HandlerFunc) HandlerFunc + func CheckHome(config string) MiddlewareFunc + func CheckServer(config string) MiddlewareFunc + func CrossDomain(config string) MiddlewareFunc + func Recover(configJSON string) MiddlewareFunc + func RequestLogger(config string) MiddlewareFunc + func WrapMiddleware(h interface{}) MiddlewareFunc + func (m MiddlewareFunc) GetMiddlewareFunc(_ string) MiddlewareFunc + type Param struct + Desc string + Format interface{} + In string + Name string + Required bool + type Pongo2Render struct + func NewPongo2Render(debug bool) *Pongo2Render + func (p *Pongo2Render) Render(w io.Writer, filename string, data interface{}, c Context) error + type RecoverConfig struct + DisablePrintStack bool + DisableStackAll bool + StackSize int + type Renderer interface + Render func(io.Writer, string, interface{}, Context) error + type Request struct + func NewRequest(req *http.Request) *Request + func (r *Request) ContentLength() int + func (r *Request) FormParams() map[string][]string + func (r *Request) IsTLS() bool + func (r *Request) MultipartForm() (*multipart.Form, error) + func (r *Request) QueryParam(name string) string + func (r *Request) QueryParams() map[string][]string + func (r *Request) RealRemoteAddr() string + func (r *Request) Scheme() string + func (r *Request) SetBody(reader io.Reader) + func (r *Request) SetRequest(req *http.Request) + type Response struct + func NewResponse(w http.ResponseWriter) *Response + func (r *Response) SetCookie(cookie *http.Cookie) + func (resp *Response) CloseNotify() <-chan bool + func (resp *Response) Committed() bool + func (resp *Response) Flush() + func (resp *Response) Header() http.Header + func (resp *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (resp *Response) SetWriter(w http.ResponseWriter) + func (resp *Response) Size() int64 + func (resp *Response) Status() int + func (resp *Response) Write(b []byte) (n int, err error) + func (resp *Response) WriteHeader(code int) + func (resp *Response) Writer() http.ResponseWriter + type Route struct + Handler string + Method string + Path string + type Router struct + func NewRouter(e *Echo) *Router + func (r *Router) Add(method, path string, h HandlerFunc, e *Echo) + func (r *Router) Find(method, path string, context Context) + func (r *Router) Process(next HandlerFunc) HandlerFunc + type SessionConfig struct + EnableSidInHttpHeader bool + EnableSidInUrlQuery bool + SessionAutoSetCookie bool + SessionCookieLifeTime int + SessionDomain string + SessionGCMaxLifetime int64 + SessionName string + SessionNameInHttpHeader string + SessionOn bool + SessionProvider string + SessionProviderConfig string + type Validator interface + Validate func() error + type VirtRouter struct + Dynamic bool + Enable bool + Hid string + Id string + Middlewares []MiddlewareConfig + Pid string + Prefix string + Type int + func Branch(prefix, desc string, nodes ...*VirtRouter) *VirtRouter + func GetVirtRouter(id string) (*VirtRouter, bool) + func Leaf(prefix string, apiHandler *ApiHandler, middlewares ...*ApiMiddleware) *VirtRouter + func NewGroupVirtRouter(prefix, desc string) *VirtRouter + func NewHandlerVirtRouter(prefix, hid string, middlewares ...MiddlewareConfig) (*VirtRouter, error) + func RootRouter() *VirtRouter + func RouterList() []*VirtRouter + func (vr *VirtRouter) AddChild(virtRouter *VirtRouter) (err error) + func (vr *VirtRouter) Children() []*VirtRouter + func (vr *VirtRouter) DelChild(virtRouter *VirtRouter) (err error) + func (vr *VirtRouter) Delete() (err error) + func (vr *VirtRouter) Description() string + func (vr *VirtRouter) Method() string + func (vr *VirtRouter) Methods() []string + func (vr *VirtRouter) Params() []Param + func (vr *VirtRouter) Parent() *VirtRouter + func (vr *VirtRouter) Path() string + func (vr *VirtRouter) Progeny() []*VirtRouter + func (vr *VirtRouter) ResetUse(middlewares []MiddlewareConfig) (err error) + func (vr *VirtRouter) SetApiHandler(hid string) error + func (vr *VirtRouter) SetEnable(able bool) (err error) + func (vr *VirtRouter) SetPrefix(prefix string) (err error) + func (vr *VirtRouter) Suffix() string + func (vr *VirtRouter) Use(middlewares ...*ApiMiddleware) *VirtRouter + type VirtRouterLock struct + Md5 string