Categorygithub.com/coscms/xweb
modulepackage
0.5.1
Repository: https://github.com/coscms/xweb.git
Documentation: pkg.go.dev

# README

xweb

xweb是一个强大的Go语言web框架。

English

Go Walker Bitdeli Badge

技术支持

QQ群:369240307

更新日志

  • v0.5.0 :
    1. Server支持平滑关闭;
    2. 静态文件和模板文件仅在使用时才缓存(优点:加快服务生效时间和节约内存),支持根据配置自动改变监控目录;
    3. 支持合并静态资源,支持同步更新合并的静态资源;
    4. 改进路由注册方式(现在变得更加智能);
    5. Server支持限制最大连接数
    6. 新增对action新返回类型:xweb.JSON/xweb.JSONP/xweb.XML/xweb.FILE等的支持
    7. app支持绑定子域名
    8. 改进https服务
    9. 其它细微调整
  • v0.4.0 :
    1. AddTmplVar改为Assign;
    2. AddTmplVars改为MultiAssign;
    3. 日志中增加IP、页面字节大小以及耗时记录(便于查找恶意访问来源);
    4. 修复bug
  • v0.3.0 : 增加对称加密、XSRF通用接口,更换hook引擎为更加优雅的events引擎
  • v0.2.1 : 自动Binding新增对jquery对象,map和array的支持。
  • v0.2 : 新增 validation 子包,从 https://github.com/astaxie/beego/tree/master/validation 拷贝过来。
  • v0.1.2 : 采用 github.com/coscms/xweb/httpsession 作为session组件,API保持兼容;Action现在必须从*Action继承,这个改变与以前的版本不兼容,必须更改代码;新增两个模板函数{{session "key"}} 和 {{cookie "key"}};Action新增函数MapForm
  • v0.1.1 : App新增AutoAction方法;Action新增Assign方法;Render方法的模版渲染方法中可以通过T混合传入函数和变量,更新了快速入门
  • v0.1.0 : 初始版本

特性

  • 在一个可执行程序中多Server(http,tls,scgi,fcgi),多App的支持
  • 简单好用的路由映射方式
  • 静态文件及版本支持,并支持自动加载,默认开启
  • 改进的模版支持,并支持自动加载,动态新增模板函数
  • session支持
  • validation支持

安装

在安装之前确认你已经安装了Go语言. Go语言安装请访问 install instructions.

安装 xweb:

go get github.com/coscms/xweb

Examples

请访问 examples folder

案例

文档

快速入门

源码文档请访问 GoWalker

License

BSD License http://creativecommons.org/licenses/BSD/

# Packages

No description provided by the author
Package httpsession is a http server session implement for Go.
No description provided by the author
No description provided by the author
The uuid package generates and inspects UUIDs.
No description provided by the author

# Functions

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
添加事件.
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
Close stops the main server.
CloseZWriter closes the io.Writer after compressing static file.
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
No description provided by the author
No description provided by the author
format bytes number friendly.
short string format.
GetAcceptEncodingZip returns accept encoding format in http header.
并发执行事件.
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
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewCookie is a helper method that returns a new http.Cookie object.
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
No description provided by the author
OpenMemZipFile returns MemFile object with a compressed static file.
No description provided by the author
No description provided by the author
No description provided by the author
print gc information to io.Writer.
Process invokes the main server's routing system.
No description provided by the author
Run starts the web application and serves HTTP requests for the main server.
RunFcgi starts the web application and serves FastCGI requests for the main server.
RunScgi starts the web application and serves SCGI requests for the main server.
RunTLS starts the web application and serves HTTPS requests for the main server.
No description provided by the author
SetLogger sets the logger for the main server.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Slug is a helper function that returns the URL slug for string s.
user[name][test].
start cpu profile monitor.
stop cpu profile monitor.
No description provided by the author
the func is the same as condition ? true : false.
No description provided by the author
No description provided by the author
No description provided by the author
Usage:Url("/user/login","appName","servName") or Url("/user/login","appName") or Url("/user/login") or UrlFor().
Urlencode is a helper method that converts a map into URL-encoded form data.
Usage:UrlFor("main:root:/user/login") or UrlFor("root:/user/login") or UrlFor("/user/login") or UrlFor()这里的main代表Server名称;root代表App名称;后面的内容为Action中方法函数所对应的网址.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
30 40 黑色.
34 44 藍色.
36 46 青藍色.
32 42 綠色.
35 45 紫紅色.
31 41 紅色.
37 47 白色.
33 43 黃色.
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
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

Config is the configuration of the main server.
No description provided by the author
* * 默认模板函数 * 除了这里定义的之外,还可以使用当前Action(即在方法中使用Render的Action)中定义的可导出的属性和方法(使用".属性"或".方法"来访问) * 另外还支持函数: * include —— Include(tmplName string) interface{} * session —— GetSession(key string) interface{} * cookie —— Cookie(key string) string * XsrfFormHtml —— XsrfFormHtml() template.HTML * XsrfValue —— XsrfValue() string * XsrfName —— XsrfName() string * StaticUrl —— StaticUrl(url string) string * 支持变量: * XwebVer —— string */.
No description provided by the author
No description provided by the author
* * 默认模板函数 * 除了这里定义的之外,还可以使用当前Action(即在方法中使用Render的Action)中定义的可导出的属性和方法(使用".属性"或".方法"来访问) * 另外还支持函数: * include —— Include(tmplName string) interface{} * session —— GetSession(key string) interface{} * cookie —— Cookie(key string) string * XsrfFormHtml —— XsrfFormHtml() template.HTML * XsrfValue —— XsrfValue() string * XsrfName —— XsrfName() string * StaticUrl —— StaticUrl(url string) string * 支持变量: * XwebVer —— string */.
No description provided by the author
No description provided by the author
[SWH|+].

# Structs

No description provided by the author
An Action object or it's substruct is created for every incoming HTTP request.
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
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
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MemFile contains MemFileInfo and bytes offset when reading.
MemFileInfo contains a compressed file bytes and file information.
No description provided by the author
Server represents a xweb server.
ServerConfig is configuration for server objects.
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
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
a struct implements this interface can be convert from request param to a struct.
No description provided by the author
a struct implements this interface can be convert from struct to template variable Not Implemented.
No description provided by the author

# Type aliases

No description provided by the author