Documentation ¶
Overview ¶
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func MustBool(c echo.Context, k string) (r bool)
- func MustFloat32(c echo.Context, k string) (r float32)
- func MustFloat64(c echo.Context, k string) (r float64)
- func MustInt(c echo.Context, k string) (r int)
- func MustInt32(c echo.Context, k string) (r int32)
- func MustInt64(c echo.Context, k string) (r int64)
- func MustString(c echo.Context, k string) (r string)
- func MustUint(c echo.Context, k string) (r uint)
- func MustUint32(c echo.Context, k string) (r uint32)
- func MustUint64(c echo.Context, k string) (r uint64)
- func MustUint8(c echo.Context, k string) (r uint8)
- type After
- type AfterHandler
- type App
- type Before
- type BeforeHandler
- type Context
- func (c *Context) AppUrl(app string, ctl string, act string, args ...interface{}) string
- func (c *Context) AppUrlFor(path string, args ...map[string]interface{}) string
- func (c *Context) Assign(key string, val interface{}) *Context
- func (c *Context) AssignX(values *map[string]interface{}) *Context
- func (c *Context) Body() ([]byte, error)
- func (c *Context) Cookie(key string, value string) *cookie.Cookie
- func (c *Context) Display(args ...interface{}) error
- func (c *Context) DisplayError(msg string, args ...int) error
- func (c *Context) Domain() string
- func (c *Context) Errno(code int, args ...string) *echo.HTTPError
- func (c *Context) Flash(name string) (r interface{})
- func (c *Context) Form(name string) string
- func (c *Context) GetCookie(key string) string
- func (c *Context) GetSecCookie(key string) (value string)
- func (c *Context) Header(name string) string
- func (c *Context) Host() string
- func (c *Context) IP() string
- func (c *Context) Init(app *App, ctl interface{}, ctlName string, actName string) error
- func (c *Context) InitSession(sess ssi.Session)
- func (c *Context) IsAjax() bool
- func (c *Context) IsDel() bool
- func (c *Context) IsGet() bool
- func (c *Context) IsHead() bool
- func (c *Context) IsOptions() bool
- func (c *Context) IsPatch() bool
- func (c *Context) IsPjax() bool
- func (c *Context) IsPost() bool
- func (c *Context) IsPut() bool
- func (c *Context) IsSecure() bool
- func (c *Context) IsUpload() bool
- func (c *Context) IsWebsocket() bool
- func (c *Context) MapForm(i interface{}, names ...string) error
- func (c *Context) Method() string
- func (c *Context) OnlyAjax() bool
- func (c *Context) PjaxContainer() string
- func (c *Context) Port() int
- func (c *Context) Protocol() string
- func (c *Context) Proxy() []string
- func (c *Context) Refer() string
- func (c *Context) Referer() string
- func (c *Context) Reset(req engine.Request, resp engine.Response)
- func (c *Context) ResolveContentType() string
- func (c *Context) ResolveFormat() string
- func (c *Context) Scheme() string
- func (c *Context) SecCookie(key string, value interface{})
- func (c *Context) Session() ssi.Session
- func (c *Context) SetCookie(key, val string, args ...interface{})
- func (c *Context) SetErr(args ...interface{}) *Context
- func (c *Context) SetNoAuth(args ...interface{}) *Context
- func (c *Context) SetNoPerm(args ...interface{}) *Context
- func (c *Context) SetOutput(code int, args ...interface{}) *Context
- func (c *Context) SetSecCookie(key string, value interface{})
- func (c *Context) SetSuc(args ...interface{}) *Context
- func (c *Context) Site() string
- func (c *Context) SubDomains() string
- func (c *Context) TmplPath(args ...string) string
- func (c *Context) Url(ctl string, act string, args ...interface{}) string
- func (c *Context) UrlFor(path string, args ...map[string]interface{}) string
- func (c *Context) Use(i ...func(IniterFunc) IniterFunc)
- type Controller
- type HandlerFunc
- type Initer
- type IniterFunc
- type Mapper
- type Output
- type Server
- func (s *Server) App(args ...string) (a *App)
- func (s *Server) Debug(on bool) *Server
- func (s *Server) FuncMap() (f map[string]interface{})
- func (s *Server) InitCodec(hashKey []byte, blockKey []byte)
- func (s *Server) InitTmpl(args ...interface{}) (tmplEng tplex.TemplateEx)
- func (s *Server) NewApp(name string, middlewares ...echo.Middleware) *App
- func (s *Server) Pprof() *Server
- func (s *Server) ResetTmpl(args ...interface{}) *Server
- func (s *Server) Run(args ...interface{})
- func (s *Server) ServeHTTP(r engine.Request, w engine.Response)
- func (s *Server) Static(absPath string, urlPath string, f ...*map[string]interface{}) *tplfunc.Static
- type Servers
- type URL
- func (a *URL) Build(app string, ctl string, act string, params ...interface{}) (r string)
- func (a *URL) BuildByPath(path string, args ...map[string]interface{}) (r string)
- func (a *URL) FuncPath(h interface{}) string
- func (a *URL) Get(key string) (u *Url)
- func (a *URL) Set(route string, h interface{}, memo ...string) (pkg string, ctl string, act string)
- func (a *URL) SetByKey(route string, key string, memo ...string) *Url
- func (a *URL) SetProjectPath(projectPath string)
- func (a *URL) Urls() map[string]*Url
- type Url
- type Webxer
- type Wrapper
Constants ¶
const ( NO_PERM = -2 //无权限 NO_AUTH = -1 //未登录 FAILURE = 0 //操作失败 SUCCESS = 1 //操作成功 )
const VERSION = `1.0.0`
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct { *Server *echo.Group //没有指定域名时有效 Handler *echo.Echo //指定域名时有效 Renderer echo.Renderer Name string Domain string Url string Dir string // contains filtered or unexported fields }
type Context ¶
type Context struct { echo.Context *Server *App *Output C interface{} ControllerName string ActionName string Language string Code int Tmpl string Format string Exit bool // contains filtered or unexported fields }
func (*Context) GetSecCookie ¶
func (*Context) InitSession ¶
func (*Context) IsUpload ¶
IsUpload returns boolean of whether file uploads in this request or not..
func (*Context) IsWebsocket ¶
IsWebsocket returns boolean of this request is in webSocket.
func (*Context) MapForm ¶
ParseStruct mapping forms' name and values to struct's field For example:
<form> <input name="user.id"/> <input name="user.name"/> <input name="user.age"/> </form> type User struct { Id int64 Name string Age string } var user User err := c.MapForm(&user,"user")
func (*Context) PjaxContainer ¶
func (*Context) ResolveContentType ¶
Get the content type. e.g. From "multipart/form-data; boundary=--" to "multipart/form-data" If none is specified, returns "text/html" by default.
func (*Context) ResolveFormat ¶
ResolveFormat maps the request's Accept MIME type declaration to a Request.Format attribute, specifically "html", "xml", "json", or "txt", returning a default of "html" when Accept header cannot be mapped to a value above.
func (*Context) SetSecCookie ¶
func (*Context) SubDomains ¶
SubDomains returns sub domain string. if aa.bb.domain.com, returns aa.bb .
func (*Context) Use ¶
func (c *Context) Use(i ...func(IniterFunc) IniterFunc)
type Controller ¶
type Controller struct {
*Context
}
func NewController ¶
func NewController(c *Context) *Controller
func (*Controller) Init ¶
func (a *Controller) Init(c *Context) error
func (*Controller) NotFound ¶
func (a *Controller) NotFound(args ...string) error
func (*Controller) Redirect ¶
func (a *Controller) Redirect(url string, args ...interface{}) error
type HandlerFunc ¶
type IniterFunc ¶
type IniterFunc func(interface{}) error
type Server ¶
type Server struct { Core *echo.Echo Name string Apps map[string]*App //域名关联 DefaultMiddlewares []echo.Middleware TemplateEngine tplex.TemplateEx TemplateDir string MaxUploadSize int64 CookiePrefix string CookieHttpOnly bool CookieAuthKey string CookieBlockKey string CookieExpires int64 CookieDomain string SessionStoreEngine string SessionStoreConfig interface{} codec.Codec Url string *URL InitContext func(*echo.Echo) interface{} // contains filtered or unexported fields }
func (*Server) InitTmpl ¶
func (s *Server) InitTmpl(args ...interface{}) (tmplEng tplex.TemplateEx)
初始化模板引擎
func (*Server) NewApp ¶
func (s *Server) NewApp(name string, middlewares ...echo.Middleware) *App
创建新app
type URL ¶
type URL struct { *Server // contains filtered or unexported fields }
func (*URL) BuildByPath ¶
func (*URL) SetProjectPath ¶
type Url ¶
type Webxer ¶
type Webxer interface { URL(echo.Handler, ...interface{}) string SetRenderer(echo.Renderer) Use(...echo.Middleware) PreUse(...echo.Middleware) Any(string, echo.Handler, ...echo.Middleware) Match([]string, string, echo.Handler, ...echo.Middleware) Trace(string, echo.Handler, ...echo.Middleware) Group(string, ...echo.Middleware) *echo.Group }
type Wrapper ¶
type Wrapper struct { //静态实例中的行为 BeforeHandler HandlerFunc AfterHandler HandlerFunc //动态实例中的行为状态 HasBefore bool HasAfter bool //实例对象 Controller interface{} Webx Webxer *App }
func (*Wrapper) R ¶
func (a *Wrapper) R(path string, h HandlerFunc, methods ...string) *Wrapper
路由注册方案1:注册函数(可匿名)或静态实例的成员函数 例如:Controller.R(`/index`,Index.Index,"GET","POST")
func (*Wrapper) RouteMethods ¶
func (a *Wrapper) RouteMethods()
路由注册方案3:自动注册动态实例内带HTTP方法名后缀的成员函数作为路由
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
lib
|
|
cachestore/redigo/redis
Package redis is a client for the Redis database.
|
Package redis is a client for the Redis database. |
cachestore/redigo/redisx
Package redisx contains experimental features for Redigo.
|
Package redisx contains experimental features for Redigo. |
captcha
Package captcha implements generation and verification of image and audio CAPTCHAs.
|
Package captcha implements generation and verification of image and audio CAPTCHAs. |
captcha/capexample
example of HTTP server that uses the captcha package.
|
example of HTTP server that uses the captcha package. |
captcha/capgen
capgen is an utility to test captcha generation.
|
capgen is an utility to test captcha generation. |
captcha/capgensounds
generate is a tool to generate sounds.go from WAVE files.
|
generate is a tool to generate sounds.go from WAVE files. |
forms/common
This package provides basic constants used by go-form-it packages.
|
This package provides basic constants used by go-form-it packages. |
forms/widgets
This package contains the base logic for the creation and rendering of field widgets.
|
This package contains the base logic for the creation and rendering of field widgets. |
middleware/method
Method implements the ability to override HTTP methods This package was created from github.com/codegangsta/martini-contrib/method and modified to work with the echo framework
|
Method implements the ability to override HTTP methods This package was created from github.com/codegangsta/martini-contrib/method and modified to work with the echo framework |
middleware/session
Session implements middleware for easily using github.com/gorilla/sessions within echo.
|
Session implements middleware for easily using github.com/gorilla/sessions within echo. |
minify
Package cssmin minifies CSS.
|
Package cssmin minifies CSS. |
tplex
* * 模板扩展 * @author swh <swh@admpub.com> Copyright 2016 Wenhui Shen <www.webx.top> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
* * 模板扩展 * @author swh <swh@admpub.com> Copyright 2016 Wenhui Shen <www.webx.top> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. |
uuid
The uuid package generates and inspects UUIDs.
|
The uuid package generates and inspects UUIDs. |