发行说明
29 分钟阅读
Release Notes 发行说明
beego 2.0.4
Note: now we force the web admin service serving HTTP only.
注意:现在我们强制 Web 管理服务仅提供 HTTP 服务。
beego 2.0.3
beego 2.0.2
beego 2.0.1
When we release v2.0.0, something wrong and then we re-release v2.0.0.
当我们发布 v2.0.0 时,出现了一些问题,然后我们重新发布了 v2.0.0。
But the checksum in sum.golang.cn is immutable, so we release this version
但是 sum.golang.cn 中的校验和是不可变的,因此我们发布此版本
beego 2.0.0
Refactor 重构
- Support the new project structure. We split the whole framework into four parts: 1.1 server: including web module. 1.2 client: including ORM, cache, httplib modules. 1.3 task: supporting timed tasks and other cyclic tasks. 1.4 core: including validation, config, logs and admin modules. 支持新的项目结构。我们将整个框架分为四个部分:1.1 服务器:包括 web 模块。1.2 客户端:包括 ORM、缓存、httplib 模块。1.3 任务:支持定时任务和其他循环任务。1.4 核心:包括验证、配置、日志和管理模块。
- Add
adapter
module which is used to reduce the effort of upgrading Beego from v1.x to v2.x 添加adapter
模块,用于减少将 Beego 从 v1.x 升级到 v2.x 的工作量 - Add
context.Context
forcache
,httplib
,session
,task
,ORM
modules’ API. 为context.Context
、cache
、httplib
、session
、task
、ORM
模块的 API 添加 - Add
error
as a return value forcache
,httplib
,session
,task
. Now users are able to know more info about what happen inside Beego. 将error
作为cache
、httplib
、session
、task
的返回值添加。现在用户能够了解有关 Beego 内部发生的事情的更多信息。 - Decouple modules from each other. All modules only depend on
core
package. 将模块彼此解耦。所有模块仅依赖于core
包。 - Support tracing, metrics in ORM, web, httplib modules. 支持 ORM、web、httplib 模块中的跟踪、指标。
- Introduce
filter-chain
patter to support AOP. 引入filter-chain
模式以支持 AOP。
Feature: 功能:
- Allow Healthcheck endpoint return JSON for Kubernetes. 4055 允许 Healthcheck 端点为 Kubernetes 返回 JSON。4055
- Support
ClientAuth
for TLS. 4116 支持ClientAuth
用于 TLS。4116 orm.RawSeter
supportsorm.Fielder
. 4191orm.RawSeter
支持orm.Fielder
。4191- Add a new MySQL operator for strict case-sensitive query. 4198 添加一个新的 MySQL 运算符,用于严格区分大小写的查询。4198
- Using
filter-chain
pattern inorm
module. Support opentracing and prometheus by using filter. 4141 在orm
模块中使用filter-chain
模式。通过使用过滤器支持 opentracing 和 prometheus。4141 - Support
prometheus
filter forhttplib
module. 4145 支持prometheus
模块的过滤器。4145 - Add additional options to redis session prov. 4137 为 redis 会话提供程序添加其他选项。4137
- Support default value filter for
orm
module. 4156 支持orm
模块的默认值过滤器。4156 - Add methods
Unmarshaler
,Sub
,OnChange
forConfiger
module. 4175 为Configer
模块添加方法Unmarshaler
、Sub
和OnChange
。4175 - Custom Log Formatter. 4174, 4179, 4188 自定义日志格式化程序。4174、4179、4188
- Support the time precision for time.Time type. 4186 支持 time.Time 类型的 time 精度。4186
- Support
etcd
in Config module. 4195 支持 Config 模块中的etcd
。4195 - Optimize rawSet.QueryRows to avoid many unnecessary calls to parseStructTag. 4210 优化 rawSet.QueryRows 以避免多次不必要的对 parseStructTag 的调用。4210
- Allow users to ignore some table when run ORM commands. 4211 允许用户在运行 ORM 命令时忽略某些表。4211
- PostgresQueryBuilder 4205
- Provides a powerful
LogFormatter
implementation PatternLogFormatter.4229 提供了强大的LogFormatter
实现 PatternLogFormatter。4229 - Support custom ES index name. 4233 支持自定义 ES 索引名称。4233
- Support multiple web servers. 4234 支持多个 Web 服务器。4234
- Support toml config. 4262 支持 toml 配置。4262
- Using unmarshaler to parse config in web module. 4266 使用 unmarshaler 解析 Web 模块中的配置。4266
- Add MaxUploadFile to provide more safety uploading control. 4275 添加 MaxUploadFile 以提供更安全的上传控制。4275
- Support using json string to init session. 4277 支持使用 json 字符串初始化会话。4277
- Support global instance for config module. 4278 支持配置模块的全局实例。4278
- Session: adds CookieSameSite to ManagerConfig. 4226 会话:将 CookieSameSite 添加到 ManagerConfig。4226
Fix: 修复:
- Fix reconnection bug in logs/conn.go. 4056 修复 logs/conn.go 中的重新连接错误。4056
- Return 413 when request payload too large. 4058 当请求有效负载过大时返回 413。4058
- Fix
index out of range
in session module whenlen(sid) < 2
. 4068 修复index out of range
在会话模块中时len(sid) < 2
. 4068 - Fix concurrent issue of context/input Query method. 4066 修复 context/input Query 方法的并发问题。4066
- Allow using environment variable to specific the config file. 4111 允许使用环境变量指定配置文件。4111
- XSRF add secure and http only flag. 4126 XSRF 添加安全且仅限 http 的标志。4126
- Fix temporary create failed on Windows 4244 修复 Windows 上临时创建失败的问题 4244
- Fix:return error after inserting data when primary key is string. 4150 修复:在主键为字符串时插入数据后返回错误。4150
- Fix the bug that Fielder’s SetRaw is not called when calling orm.Raw() to query from database. 4160 修复 Fielder 的 SetRaw 在调用 orm.Raw() 从数据库查询时未被调用的错误。4160
- Fix: return error when calling
InsertOrUpdate
is successful with string primary key. 4158 修复:在使用字符串主键成功调用InsertOrUpdate
时返回错误。4158 - Fix the problem that the nested structure of queryRow() cannot assign values 4173 修复 queryRow() 的嵌套结构无法分配值的问题 4173
- Empty field in validator.Error when label struct tag is not declared. 4225 当未声明标签结构时,validator.Error 中的字段为空。4225
- Fix deadlock in task module. 4246 修复任务模块中的死锁。4246
- Fix: form entity too large casue run out of memory. 4272 修复:表单实体太大导致内存不足。4272
Doc: 文档:
beego 1.12.3
Feature: 功能:
- Allow Healthcheck endpoint return JSON for Kubernetes. 4055 允许 Healthcheck 端点为 Kubernetes 返回 JSON。4055
- Support
ClientAuth
for TLS. 4116 支持ClientAuth
用于 TLS。4116 orm.RawSeter
supportorm.Fielder
. 4191orm.RawSeter
支持orm.Fielder
。4191- Add a new MySQL operator for strict case sensitive query. 4198 添加一个新的 MySQL 运算符,用于严格区分大小写的查询。4198
Fix: 修复:
- Fix reconnection bug in logs/conn.go. 4056 修复 logs/conn.go 中的重新连接错误。 4056
- Return 403 when request payload too large. 4058 当请求有效负载过大时返回 403。 4058
- Fix race condition for Prepare Statement cache. 4061 修复预处理语句缓存的竞争条件。4061
- Fix
index out of range
in session module whenlen(sid) < 2
. 4068 修复index out of range
在len(sid) < 2
时会话模块中的 4068 - Fix concurrent issue of context/input Query method. 4066 修复 context/input Query 方法的并发问题。4066
- Allow using environment variable to specific the config file. 4111 允许使用环境变量指定配置文件。4111
- XSRF add secure and http only flag. 4126 XSRF 添加安全且仅限 http 的标志。4126
- Fix temporary create failed on Windows 4244 修复 Windows 上的临时创建失败 4244
- Session: adds CookieSameSite to ManagerConfig. 4226 Session:将 CookieSameSite 添加到 ManagerConfig。4226
- Make stmt cache smaller to avoid
too many statement
error. 4261 减小语句缓存以避免too many statement
错误。4261
beego 1.12.2
- Fix old process didn’t exist when graceful restart in beego 1.12.0 #4005 修复 beego 1.12.0 中优雅重启时旧进程不存在的问题 #4005
- Enhance: Print stack while orm abnormally exit #3743 增强:在 orm 异常退出时打印堆栈 #3743
- Enhance: Replacing lock with read lock in GetMapData #3803 增强:在 GetMapData 中用读锁替换锁 #3803
- Fix: Get the real location of the log directory if the path is symbolic path #3818 修复:如果路径是符号路径,则获取日志目录的真实位置 #3818
- Fix: Cache, context, session: add lock to fix inconsistent field protection #3922 修复:缓存、上下文、会话:添加锁以修复不一致的字段保护 #3922
- Fix: Encoded url(with slash) router mismatch problem #3943 修复:编码的 url(带斜杠)路由器不匹配问题 #3943
- Fix: genRouterCode method generate wrong codes #3981 修复:genRouterCode 方法生成错误的代码 #3981
- Enhance: Using LRU algorithm, ignoring big file and using max cache size to reduce the memory usage of file cache #3984 增强:使用 LRU 算法,忽略大文件并使用最大缓存大小来减少文件缓存的内存使用量 #3984
- Fix: Set max DB connections #3985 修复:设置最大数据库连接数 #3985
- Fix: SQLite don’t support SELECT … FOR UPDATE #3992 修复:SQLite 不支持 SELECT … FOR UPDATE #3992
- Enhance: Add Transfer-Encoding header in httplib’s PostFile method #3993 增强:在 httplib 的 PostFile 方法中添加 Transfer-Encoding 头 #3993
- Enhance: Support bit operation in ORM #3994 增强:支持 ORM 中的位运算 #3994
- Fix: net/http Middleware set via RunWithMiddleware or App.Run(middleware) doesn’t work when “BConfig.Listen.Graceful” is set to true #3995 修复:当 “BConfig.Listen.Graceful” 设置为 true 时,通过 RunWithMiddleware 或 App.Run(middleware) 设置的 net/http 中间件不起作用 #3995
- Fix: Empty field in validator.Error when label struct tag is not declared #4001 修复:当标签结构未声明时,validator.Error 中的字段为空 #4001
- Fix: panic: send on closed channel after closing logger #4004 修复:在关闭日志记录器后恐慌:发送到已关闭的通道 #4004
- Enhance: Store RouterPattern before filter execute #4007 增强:在过滤器执行之前存储 RouterPattern #4007
- Fix: Using HTMLEscapeString in adminui.go to avoid XSS attack #4018 修复:在 adminui.go 中使用 HTMLEscapeString 以避免 XSS 攻击 #4018
- Fix: Process not closed when graceful set to true #4005 修复:当 graceful 设置为 true 时,进程未关闭 #4005
- Enhance: Use scan instead of keys in redis #4016 增强:在 redis 中使用 scan 代替 keys #4016
- Feature: Support prometheus #4021 特性:支持 prometheus #4021
- Fix: Can’t create more than max_prepared_stmt_count statements #4025 修复:无法创建超过 max_prepared_stmt_count 条语句 #4025
- Enhance: Support more mobile number pattern #4027 增强:支持更多手机号码模式 #4027
- Fix: Can’t set section name #4027 修复:无法设置节名称 #4027
- Fix: strings.Repeat panic in orm/db.go #4032 修复:orm/db.go 中的 strings.Repeat 恐慌 #4032
- Enhance: Make redis client idle timeout configurable #4033 增强:使 redis 客户端空闲超时时间可配置 #4033
beego 1.10.0
- Update log.go add GetLevel Function to Log #2970 更新 log.go,为日志添加 GetLevel 函数 #2970
- Fix a typo “conflict” #2971 修复一个错别字“conflict” #2971
- Bug on private fields #2978 私有字段上的错误 #2978
- Fix access log console unexpected ‘\n’ at end of each log. #2976 修复访问日志控制台在每条日志末尾意外出现“\n”。#2976
- Fix Documentation for HTTP status codes descriptions. #2992 修复 HTTP 状态码说明的文档。#2992
- Redis cache: make MaxIdle configurable #3004 Redis 缓存:使 MaxIdle 可配置 #3004
- Update: Fix migration generate SQL #3017 更新:修复迁移生成 SQL #3017
- Handle pointer validation #3046 处理指针验证 #3046
- Fix the issue TaseCase TestFormatHeader_0 is failed #3066 修复问题 TaseCase TestFormatHeader_0 失败 #3066
- Fix BEEGO_RUNMODE #3064 修复 BEEGO_RUNMODE #3064
- Swagger: Allow example values with different types, allow example for enum. #3085 Swagger:允许具有不同类型的示例值,允许枚举的示例。#3085
- Fix the bug: unable to add column with ALTER TABLE #2999 修复错误:无法使用 ALTER TABLE 添加列 #2999
- Set default Beego RunMode to production #3076 将默认 Beego RunMode 设置为生产 #3076
- Fix typo #3103 修复错别字 #3103
- In dev mode, template parse error cause program lock #3126 在开发模式下,模板解析错误导致程序锁定 #3126
- Amend a very minor typo in a variable name #3115 修改变量名称中的一个非常小的错别字 #3115
- When log maxSize set big int,FileWrite Init fail #3109 当 log maxSize 设置为 big int 时,FileWrite Init 失败 #3109
- Change github.com/garyburd/redigo to newest branch github.com/gomodul… #3100 将 github.com/garyburd/redigo 更改为最新分支 github.com/gomodul… #3100
- ExecElem.FieldByName as local variable #3039 ExecElem.FieldByName 作为局部变量 #3039
- Allow log prefix #3145 允许日志前缀 #3145
- Refactor yaml config for support multilevel #3127 重构 yaml 配置以支持多级 #3127
- Create redis_cluster.go #3175 创建 redis_cluster.go #3175
- Add field comment on create table #3190 在创建表时添加字段注释 #3190
- Update: use PathEscape replace QueryEscape #3200 更新:使用 PathEscape 替换 QueryEscape #3200
- Update gofmt #3206 更新 gofmt #3206
- Update: Htmlquote Htmlunquote #3202 更新:Htmlquote Htmlunquote #3202
- Add ‘FOR UPDATE’ support for querySet #3208 为 querySet 添加“FOR UPDATE”支持 #3208
- Debug stringsToJSON #3171 调试 stringsToJSON #3171
- Fix defaut value bug, and add config for maxfiles #3185 修复默认值错误,并添加 maxfiles 的配置 #3185
- Fix: correct MaxIdleConnsPerHost value to net/http default 100. #3230 修复:将 MaxIdleConnsPerHost 值更正为 net/http 默认值 100。#3230
- Fix: When multiply comment routers on one func #3217 修复:在一个函数上多次注释路由器 #3217
- Send ErrNoRows if the query returns zero rows … in method orm_query… #3247 如果查询返回零行,则发送 ErrNoRows … 在方法 orm_query… 中 #3247
- Fix typo #3245 修复错别字 #3245
- Add session redis IdleTimeout config #3239 添加会话 redis IdleTimeout 配置 #3239
- Fix the wrong status code in prod #3226 修复产品中的错误状态代码 #3226
- Add method to set the data depending on the accepted #3182 添加根据接受的数据设置数据的方法 #3182
- Fix Unexpected EOF bug in staticfile #3152 修复 staticfile 中的意外 EOF 错误 #3152
- Add code style for logs README #3146 添加日志 README 的代码样式 #3146
- Fix response http code #3142 修复响应 http 代码 #3142
- Improve access log #3141 改进访问日志 #3141
- Auto create log dir #3105 自动创建日志目录 #3105
- Html escape before display path, avoid xss #3022 显示路径前进行 Html 转义,避免 xss #3022
- Acquire lock when access config data #3250 访问配置数据时获取锁 #3250
- Fix orm fields SetRaw function error judge problem #2985 修复 orm 字段 SetRaw 函数错误判断问题 #2985
- Fix template rendering with automatic mapped parameters (see #2979) #2981 修复使用自动映射参数进行模板渲染(参见 #2979) #2981
- Fix the model can not be registered correctly on Ubuntu 32bit #2997 修复模型无法在 Ubuntu 32 位上正确注册 #2997
- Feature/yaml #3181 功能/yaml #3181
- Feature/autocert #3249 功能/autocert #3249
beego 1.9.0
- Fix the new repo address for casbin #2654 修复 casbin 的新仓库地址 #2654
- Fix cache/memory fatal error: concurrent map iteration and map write #2726 修复缓存/内存致命性问题:并发映射迭代和映射写入 #2726
- AddAPPStartHook func modify #2724 AddAPPStartHoook 函数进行更改 #2724
- Fix panic: sync: negative WaitGroup counter #2717 修复恐慌:同步:负的等待组计数器 #2717
- incorrect error rendering (wrong status) #2712 不正确的渲染(不正确的状况) #2712
- validation: support int64 int32 int16 and int8 type #2728 验证:int64 int32 int16 并且 int8 类型 #2728
- validation: support required option for some struct tag valids #2741 验证:为某些结构体标记有效值提供必需的选项 #2741
- Fix big form parse issue #2725 修复大型表格解析问题 #2725
- File log add RotatePerm #2683 文件日志中增加了 RotatePerm #2683
- Fix Oracle placehold #2749 修复 Oracle 占位符 #2749
- Supported gzip for req.Header has Content-Encoding: gzip #2754 Supported\u96e3 req.Header 中包含 Content-Coding:\u96e3 #2754
- Add new Database Migrations #2744 添加新的数据库迁移 #2744
- Beego auto generate sort ControllerComments #2766 Beego 自动生成排序 ControllerComments #2766
- added statusCode and pattern to FilterMonitorFunc #2692 在 FilterMonitorFunc 中添加了 statusCode 和 pattern #2692
- fix the bugs in the “ParseBool” function in the file of config.go #2740 修复 config.go 文件中“ParseBool”函数中的错误 #2740
bee 1.9.0
- Added MySQL year data type #443 添加了 MySQL 年数据类型 #443
- support multiple http methods #445 支持多种 http 方法 #445
- The DDL migration can now be generated by adding a -ddl and a proper “alter” or “create” as argument value. #455 现在可以通过添加 -ddl 和适当的“alter”或“create”作为参数值来生成 DDL 迁移。 #455
- Fix: docs generator skips everything containing ‘vendor’ #454 修复:文档生成器跳过包含“vendor”的所有内容 #454
- get these tables information in custom the option #441 在自定义选项中获取这些表信息 #441
- read ref(pk) #444
- Add command bee server to server static folder. 将命令 bee server 添加到服务器静态文件夹。
beego 1.7.1
New features:
新功能:
- Added IP for access log #2156 添加 IP 以访问日志 #2156
- ReadForUpdate or ORM #2158 ReadForUpdate 或 ORM #2158
- Parameters binding supports form,columns[0].Data=foo&columns[1].Data=bar&columns[2].Data=baz #2111 参数绑定支持表单,columns[0].Data=foo&columns[1].Data=bar&columns[2].Data=baz #2111
- Added
beego.BConfig.RecoverFunc
for custom recover method. #2004 添加beego.BConfig.RecoverFunc
以获取自定义恢复方法。#2004 - memcache cache supports byte and string. So as to cache struct by gob#1521 memcache 缓存支持字节和字符串。以便通过 gob 缓存结构 #1521
- ORM delete by condition. #1802 ORM 按条件删除。#1802
- swagger doc supports yaml #2162 swagger 文档支持 yaml #2162
- Added RunController and RunMethod for customized router rules #2017 添加了 RunController 和 RunMethod 以实现自定义路由规则 #2017
Bug fixes:
错误修复:
- No / added while visiting static folder who contains index.html. For example visit /swagger won’t redirect to /swagger/ so that relitive css and js won’t be access. #2142 访问包含 index.html 的静态文件夹时未添加 /。例如,访问 /swagger 不会重定向到 /swagger/,因此无法访问相对的 css 和 js。#2142
- Time in Beego admin UI displayed alphabetically other than ordered by us or ms. #1877 Beego 管理 UI 中的时间按字母顺序显示,而不是按我们或毫秒排序。#1877
- Crash while captcha generates by custom height and width. #2161 通过自定义高度和宽度生成验证码时崩溃。#2161
- Panic while empty body requested with DELETE method when CopyBody enabled. #1656 启用 CopyBody 时,使用 DELETE 方法请求空主体时发生恐慌。#1656
beego 1.7.0
New features:
新特性:
- Improved Filter speed by 7.5+ times #1799 将 Filter 速度提高了 7.5 倍以上 #1799
- Multiple level for Gzip compression #1808 Gzip 压缩的多级 #1808
- Negative numbers for ORM PK #1810 ORM PK 的负数 #1810
- Custom auto-increasing ID for ORM #1826 ORM 的自定义自动递增 ID #1826
- Improved Context file downloading: check file existence before download#1827 改进的上下文文件下载:下载前检查文件是否存在 #1827
GetLogger
method for log module #1832 日志模块的GetLogger
方法 #1832
package main
import "github.com/beego/beego/v2/logs"
func main() {
logs.Warn("this is a warn message")
l := logs.GetLogger("HTTP")
l.Println("this is a message of http")
logs.GetLogger("orm").Println("this is a message of orm")
logs.Debug("my book is bought in the year of ", 2016)
logs.Info("this %s cat is %v years old", "yellow", 3)
logs.Error(1024, "is a very", "good", 2.5, map[string]int{"id": 1})
logs.Critical("oh my god")
}
7. Log for session if error occurred. #1833 8. Public methods for logs: EnableFuncCallDepth
and SetLogFuncCallDepth
for setting function call level. #1837 9. Use go run
to run beego project #1840 10. Added ExecuteTemplate
method which is used to access template other than use map since map is not safe for concurrent reading and writing. #1848 11. time
type for ORM field #1856 12. ORM One only fetch one record #1874 13. ORM suports json jsonb type #1875 14. ORM uses text type by default. #1879 15. session configurations: EnableSidInHttpHeader
EnableSidInUrlQuery
SessionNameInHttpHeader
let user pass sid in http header or in URL. #1897 16. Shorten fileanme of auto-generated router file name. #1924 17. Complex template engine. ace jade #1940
7. 如果发生错误,则记录会话。#1833 8. 日志的公共方法: EnableFuncCallDepth
和 SetLogFuncCallDepth
用于设置函数调用级别。#1837 9. 使用 go run
运行 beego 项目 #1840 10. 添加 ExecuteTemplate
方法,用于访问模板,而不是使用映射,因为映射不适用于并发读写。#1848 11. ORM 字段的 time
类型 #1856 12. ORM One 只获取一条记录 #1874 13. ORM 支持 json jsonb 类型 #1875 14. ORM 默认使用 text 类型。#1879 15. 会话配置: EnableSidInHttpHeader
EnableSidInUrlQuery
SessionNameInHttpHeader
允许用户在 http 头或 URL 中传递 sid。#1897 16. 缩短自动生成的路由器文件名。#1924 17. 复杂的模板引擎。ace jade #1940
beego.AddTemplateEngine("ace", func(root, path string, funcs template.FuncMap) (*template.Template, error) {
aceOptions := &ace.Options{DynamicReload: true, FuncMap: funcs}
aceBasePath := filepath.Join(root, "base/base")
aceInnerPath := filepath.Join(root, strings.TrimSuffix(path, ".ace"))
tpl, err := ace.Load(aceBasePath, aceInnerPath, aceOptions)
if err != nil {
return nil, fmt.Errorf("error loading ace template: %v", err)
}
return tpl, nil
})
#1940 18. session suports ssdb #1953 19. RenderForm supports required #1993 20. Beautified beego logs #1997
#1940 18. 会话支持 ssdb #1953 19. RenderForm 支持 required #1993 20. 美化的 beego 日志 #1997
21. ORM suports time.Time
pointer in struct #2006 22. TplPrefix
in Controller for setting prefix folder in baseController #2030 23. js function checking in jsonb to avoid non-exist methods. #2045 24. InsertOrUpdate
method in ORM #2053 25. Filter method added parameter for resetting parameters. Because when using beego.InsertFilter("*", beego.BeforeStatic, RedirectHTTP)
parameter will be assigned to :splat
which will affect other useful routers. #2085 26. session initialized by object other than json. It might have issue for the projects use session module separately. #2096 27. Upgraded Swagger to 2.0. The code generated now doesn’t rely on API. beego generat swagger.json directly.
21. ORM 支持结构体中的 time.Time
指针 #2006 22. TplPrefix
在 Controller 中用于设置 baseController 中的前缀文件夹 #2030 23. js 函数在 jsonb 中检查以避免不存在的方法。 #2045 24. InsertOrUpdate
方法在 ORM 中 #2053 25. Filter 方法添加了用于重置参数的参数。因为在使用 beego.InsertFilter("*", beego.BeforeStatic, RedirectHTTP)
时,参数将被分配给 :splat
,这会影响其他有用的路由器。 #2085 26. 由非 json 对象初始化的会话。对于单独使用会话模块的项目,这可能会出现问题。 #2096 27. 将 Swagger 升级到 2.0。现在生成的代码不依赖于 API。beego 直接生成 swagger.json。
bugfix:
错误修复:
/m
redirect to/m/
automatically in static reouters. #1792/m
在静态路由器中自动重定向到/m/
。 #1792- Parsing config file error while testing #1794 测试时解析配置文件错误 #1794
- Race condition while rotate file. #1803 轮换文件时出现竞争条件。 #1803
- Fixed multiple response.WriteHeader calls error. #1805 修复了多次调用 response.WriteHeader 的错误。 #1805
- Fixed panic if primary key is uint in ORM #1828 修复了 ORM 中主键为 uint 时出现的恐慌。 #1828
- Fixed panic if current time is less than 2000 while rotate logs. # 修复了轮换日志时当前时间小于 2000 时出现的恐慌。 #
- Fixed XSRF reuse caused by context reuse.#1863 修复了由上下文重用导致的 XSRF 重用。 #1863
- Panic while InsertMulti * type in ORM #1882 ORM 中 InsertMulti * 类型时出现恐慌 #1882
- Multiple execution of task in a very short time. #1909 在很短的时间内多次执行任务。#1909
- Garbled file name in IE #1912 IE 中的文件名乱码 #1912
- ORM DISTINCT #1938
- Can’t use int while setting file permit in Logs module. #1948 #2003 在日志模块中设置文件权限时无法使用 int。#1948 #2003
- Empty foreign key for QueryRow and QueryRows. #1964 QueryRow 和 QueryRows 的外键为空。#1964
- Retrieving scheme from X-Forwarded-Proto when it isn’t none. #2050 当 X-Forwarded-Proto 不为 none 时,从其中检索方案。#2050
- Add query parameters for redirecting static path to
path/
#2064 添加查询参数以将静态路径重定向到path/
#2064
beego 1.6.1
New features
新特性
- Oracle driver for ORM ORM 的 Oracle 驱动程序
- inline mode for ORM Model ORM 模型的内联模式
- ssdb engine for Cache Cache 的 ssdb 引擎
- Color scheme configure for console out 控制台输出的颜色方案配置
- travis integration travis 集成
- mulitfile engine for Log. Write logs from different levels to different files. 日志的多文件引擎。将不同级别的日志写入不同的文件。
bugfix:
错误修复:
- cookie time config cookie 时间配置
- Router rule mapping #1580 路由规则映射 #1580
- No logs before beego.Run() 在 beego.Run() 之前没有日志
- Returning nil while []string is empty in config 在 config 中 []string 为空时返回 nil
- Wrong comment for ini engine ini 引擎的错误注释
- Log time delay while store log asynchronously 异步存储日志时日志时间延迟
- Config file parsed twice. 配置文件被解析了两次。
- Can’t handle
()
in URL for regex router. 正则路由器 URL 中无法处理()
。 - Chinese encoding issue in mail 邮件中的中文编码问题
- No Distinct in ORM ORM 中没有 Distinct
- Compiling error in Layout 布局中的编译错误
- Wrong file name in logrotate logrotate 中的文件名错误
- Invalid CORS if CORS plugin fail. 如果 CORS 插件失败,则 CORS 无效。
- Conflicting between path params and router params in filters 过滤器中路径参数和路由器参数冲突
- Return 404 other than 200 if static files are not found. 如果找不到静态文件,则返回 404 而不是 200。
- Added GroupBy interface 添加了 GroupBy 接口
- Static file crush caused by accessing map concurrently of Go 1.6 Go 1.6 中并发访问映射导致静态文件崩溃
- Extra newline output by json.Encoder of JSONBody in httplib httplib 中 JSONBody 的 json.Encoder 输出额外的换行符
- Missing log when Close if use flush in log under asynchronous mode. 在异步模式下,如果在日志中使用 flush,则 Close 时缺少日志。
beego 1.6.0
New features:
新特性:
log
supports rotating files likexx.2013-01-01.2.log
#1265log
支持轮换文件,例如xx.2013-01-01.2.log
#1265context.response
supports Flush, Hijack, CloseNotifycontext.response
支持 Flush、Hijack、CloseNotify- ORM supports Distinct #1276 ORM 支持 Distinct #1276
map_get
template method #1305map_get
模板方法 #1305- ORM supports tidb engine #1366 ORM 支持 tidb 引擎 #1366
- httplib request supports []string #1308 httplib 请求支持 []string #1308
- ORM
querySeter
addedGroupBy
method #1345 ORMquerySeter
添加GroupBy
方法 #1345 - Session’s MySQL engine supports custom table name #1348 Session 的 MySQL 引擎支持自定义表名 #1348
- Performance of log’s file engine improved 30%; Supports set log file’s permission #1560 日志文件引擎性能提升 30%;支持设置日志文件权限 #1560
- Get session by query #1507 通过查询获取会话 #1507
- Cache module supports multiple Cache objects. Cache 模块支持多个 Cache 对象
- validation supports custom validation functions 验证支持自定义验证函数
bugfix:
bind
method incontext
caused crash when parameter is empty. #1245bind
方法在参数为空时导致崩溃。#1245- manytomany in ORM reverse error #671 ORM 反向错误中的 manytomany #671
- http: multiple response.WriteHeader calls #1329 http: 多次 response.WriteHeader 调用 #1329
- ParseForm uses local timezone while parsing date #1343 ParseForm 在解析日期时使用本地时区 #1343
- Emails sent by log’s SMTP engine can’t be authorised 日志的 SMTP 引擎发送的电子邮件无法授权
- Fixed some issues in router:
/topic/:id/?:auth
,/topic/:id/?:auth:int
#1349 修复了路由器中的某些问题:/topic/:id/?:auth
、/topic/:id/?:auth:int
#1349 - Fixed the crash caused by nil while parsing comment documentation. #1367 修复了在解析注释文档时由 nil 导致的崩溃。#1367
- Can’t read
index.html
in static folder 无法在静态文件夹中读取index.html
dbBase.Update
doesn’t return err if failed #1384dbBase.Update
在 中如果失败不会返回错误 #1384Required
invalidation
only works for int but not for int64Required
在validation
中仅适用于 int,而不适用于 int64- orm: Fix handling of rel(fk) to model with string pk #1379 orm: 修复 rel(fk) 到具有字符串 pk 的模型的处理 #1379
- graceful error while both http and https enabled #1414 在 http 和 https 均启用时优雅地出错 #1414
- If ListenTCP4 enabled and httpaddr is empty, it still listens TCP6 如果启用了 ListenTCP4 且 httpaddr 为空,它仍会侦听 TCP6
- migration doesn’t support postgres #1434 迁移不支持 postgres #1434
- Default values of ORM text, bool will cause error while creating tables. ORM 文本、布尔值的默认值在创建表时会导致错误。
- graceful panic: negative WaitGroup counter 优雅地恐慌:负 WaitGroup 计数器
Improvement:
改进:
- Moved example to samples 将示例移至样本
- Passed golint 通过 golint
- Rewrote router, improved performance by 3 times. 重写路由器,将性能提高 3 倍。
- Used
sync.Pool
forcontext
to improve performance 使用sync.Pool
来context
以提高性能 - Improved template compiling speed. #1298 提高了模板编译速度。#1298
- Improved config 改进了配置
- Refactored whole codebase for readability and maintainability 重构了整个代码库以提高可读性和可维护性
- Moved all init code into
AddAPPStartHook
将所有初始化代码移至AddAPPStartHook
- Removed
middleware
. Will only useplugins
移除了middleware
。将只使用plugins
- Refactored
Error
handling. 重构了Error
处理。
Beego 1.5.0
New Features:
新特性:
- Graceful shutdown 优雅关机
- Added
JsonBody
method tohttplib
which supporting sending raw body as JSON format 在httplib
中添加JsonBody
方法,该方法支持将原始正文作为 JSON 格式发送 - Added
AcceptsHtml
AcceptsXml
AcceptsJson
methods tocontext input
在context input
中添加AcceptsHtml
AcceptsXml
AcceptsJson
方法 - Get config files from Runmode first 首先从 Runmode 获取配置文件
httplib
supportsgzip
httplib
支持gzip
log
module stop using asynchronous mode by defaultlog
模块默认停止使用异步模式validation
supports recursionvalidation
支持递归- Added
apk mime
添加apk mime
ORM
supportseq
anne
ORM
支持eq
和ne
Bugfixes:
错误修复:
- Wrong parameters for ledis driver. ledis 驱动程序的参数错误。
- When user refresh the page after the captcha code expired from the cache, it returns 404. Generating new captcha code for reloading. 当用户在验证码从缓存中过期后刷新页面时,它会返回 404。生成新的验证码以重新加载。
- Controller defines Error exception 控制器定义错误异常
- cookie doesn’t work in window IE cookie 在 window IE 中不起作用
- GetIn returns nil error while getting non-exist variable GetIn 在获取不存在的变量时返回 nil 错误
- More cellphone validation code 更多手机验证代码
- Wrong router matching 错误的路由器匹配
- The
panic
returns http 200panic
返回 http 200 - The database setting erros caused by redis session 由 redis 会话引起的数据库设置错误
- The issue that https and http don’t share session https 和 http 不共享会话的问题
- Memcache session driver returns error if it’s empty Memcache 会话驱动程序在为空时返回错误
Beego 1.4.3
New Features:
新特性:
- ORM support default settting ORM 支持默认设置
- improve logs/file line count 改进日志/文件行计数
- sesesion ledis support select db sesesion ledis 支持选择数据库
- session redis support select db session redis 支持选择数据库
- cache redis support select db cache redis 支持选择数据库
UrlFor
support all type of the parametersUrlFor
支持所有类型的参数- controller
GetInt/GetString
function support default value, like:GetInt("a",12)
控制器GetInt/GetString
函数支持默认值,例如:GetInt("a",12)
- add
CompareNot/NotNil
template function 添加CompareNot/NotNil
模板函数 - support Controller defeine error,controller Error 支持控制器定义错误,控制器错误
ParseForm
support slices of ints and stringsParseForm
支持整数和字符串切片- improve ORM interface 改进 ORM 接口
bugfix:
- context get wrong subdomain context 获取错误的子域
beego.AppConfig.Strings
when the strings is empty, always return[]string{}
beego.AppConfig.Strings
当字符串为空时,始终返回[]string{}
- utils/pagination can’t modify the attributes utils/pagination 无法修改属性
- when the request url is empty, route tree crashes 当请求 url 为空时,路由树崩溃
- can’t click the link to run the task in adminui 无法点击链接在 adminui 中运行任务
- FASTCGI restart didn’t delete the unix Socket file FASTCGI 重启未删除 unix Socket 文件
Beego 1.4.2
New Features:
新特性:
Added SQL Constructor inspired by ZEND ORM.
添加了受 ZEND ORM 启发的 SQL 构造器。
Added
GetInt()
,GetInt8()
,GetInt16()
,GetInt32()
,GetInt64()
for Controller. 为 Controller 添加了
GetInt()
、GetInt8()
、GetInt16()
、GetInt32()
、GetInt64()
。Improved the logging. Added
FilterHandler
for filter logging output. 改进了日志记录。添加了
FilterHandler
用于过滤日志输出。Static folder supports
index.html
. Automatically adding/
for static folders. 静态文件夹支持
index.html
。自动为静态文件夹添加/
。flash
supportssuccess
andset
methods.
flash
支持success
和set
方法。Config for ignoring case for routers:
RouterCaseSensitive
. Case sensitive by default. 忽略路由器大小写的配置:
RouterCaseSensitive
。默认情况下区分大小写。Configs load based on environment:
beego.AppConfig.String("myvar")
return 456 on dev mode and return 123 on the other modes. 根据环境加载配置:
beego.AppConfig.String("myvar")
在开发模式下返回 456,在其他模式下返回 123。runmode = dev myvar = 123 [dev] myvar = 456
Added
include
forini
config files: 为
ini
配置文件添加include
:appname = btest include b.conf
Added
paginator
utils. 添加
paginator
utils。Added
BEEGO_RUNMODE
environment variable. You can change the application mode by changing this environment variable. 添加
BEEGO_RUNMODE
环境变量。您可以通过更改此环境变量来更改应用程序模式。Added Json function for fetching
statistics
intoolbox
. 添加 Json 函数以在
toolbox
中获取statistics
。Attachements support for mail utils.
邮件工具的附件支持。
Turn on fastcgi by standard IO.
通过标准 IO 打开 fastcgi。
Using
SETEX
command to support the old version redis in redis Session engine. 使用
SETEX
命令在 redis Session 引擎中支持旧版本 redis。RenderForm supports html id and class by using id and class tag.
RenderForm 通过使用 id 和 class 标记支持 html id 和 class。
ini config files support BOM head.
ini 配置文件支持 BOM 头。
Added new Session engine
ledis
. 添加了新的 Session 引擎
ledis
。Improved file uploading in
httplib
. Supporting extremely large files by usingio.Pipe
. 改进了
httplib
中的文件上传。通过使用io.Pipe
支持超大文件。Binding to TCP4 address by default. It will bind to ipv6 in GO. Added config variable
ListenTCP4
. 默认情况下绑定到 TCP4 地址。它将在 GO 中绑定到 ipv6。添加了配置变量
ListenTCP4
。off/on/yes/no/1/0 will parse to
bool
in form rendering. Support time format. off/on/yes/no/1/0 将在表单渲染中解析为
bool
。支持时间格式。Simplify the generating of SeesionID. Using golang buildin
rand
function other thanhmac_sha1
. 简化 SeesionID 的生成。使用 golang 内置
rand
函数而不是hmac_sha1
。
bugfix:
错误修复:
- XSRF verification failure while
PUT
andDELETE
cased by lowercased_method
由于小写的_method
导致PUT
和DELETE
中的 XSRF 验证失败 - No error message returned while initialize the cache by
StartAndGC
使用StartAndGC
初始化缓存时未返回错误消息 - Can’t set
User-Agent
inhttplib
无法在httplib
中设置User-Agent
- Improved
DelStaticPath
已改进DelStaticPath
- Only finding files in the first static folder when using multiple static folders 使用多个静态文件夹时仅在第一个静态文件夹中查找文件
Filter
functions can’t execute afterAfterExec
andFinishRouter
Filter
函数无法在AfterExec
和FinishRouter
之后执行- Fixed uninitialized mime 修复了未初始化的 mime
- Wrong file name and line number in the log 日志中的文件名和行号错误
- Can’t send the request while only uploading one file in
httplib
在httplib
中仅上传一个文件时无法发送请求 - Improved the
Abort
output message. It couldn’t out undefined error message before. 改进了Abort
输出消息。以前无法输出未定义的错误消息。 - Fixed the issue that can’t add inner Filter while no out Filter set in the nested
namespaces
修复了在嵌套的namespaces
中未设置外部过滤器时无法添加内部过滤器的错误 - Router mapping error while router has multiple level parameters. #824 路由器有多级参数时出现路由器映射错误。#824
- The information lossing while having many
namespaces
for the commented router. #770 注释的路由器有多个namespaces
时会丢失信息。#770 urlfor
function calling useless {{placeholder}} #759urlfor
函数调用无用 {{placeholder}} #759
Beego 1.4.1
New features:
新特性:
context.Input.Url
get path info without domain scheme.context.Input.Url
获取不带域方案的路径信息。- Added plugin
apiauth
to simulate theAWS
encrypted requests. 添加插件apiauth
来模拟AWS
加密请求。 - Simplified the debug output for router info. 简化路由器信息的调试输出。
- Supportting pointer type in ORM. 在 ORM 中支持指针类型。
- Added
BasicAuth
, cache for multiple requests 添加BasicAuth
,缓存多个请求
bugfix:
- Router . can’t be parsed 无法解析路由器
Beego 1.3.0
Hi guys! After the hard working for one month, we are so excited to release Beego 1.3.0. We brought many useful features. Upgrade notes
嗨,伙计们!经过一个月的努力工作,我们非常高兴地发布 Beego 1.3.0。我们带来了许多有用的功能。升级说明
The brand new router system 全新的路由器系统
We rewrote the router system to tree router. It improved the performance significantly and supported more formats.
我们将路由器系统重写为树形路由器。它显著提高了性能并支持更多格式。
For the routers below:
对于以下路由器:
/user/astaxie
/user/:username
If the request is /user/astaxie
, it will match fixed router which is the first one; If the request is /user/slene
, it will match the second one. The register order doesn’t matter.
如果请求是 /user/astaxie
,它将匹配固定路由器,即第一个路由器;如果请求是 /user/slene
,它将匹配第二个路由器。注册顺序无关紧要。
namespace is more elegant 命名空间更加优雅
namespace
is designed for modular applications. It was using chain style similar to jQuery in previous version but gofmt
can’t format it very well. Now we are using multi parameters style: (The chain style still works)
namespace
专为模块化应用程序而设计。它在以前的版本中使用类似于 jQuery 的链式样式,但 gofmt
无法很好地格式化它。现在我们使用多参数样式:(链式样式仍然有效)
ns :=
beego.NewNamespace("/v1",
beego.NSNamespace("/shop",
beego.NSGet("/:id", func(ctx *context.Context) {
ctx.Output.Body([]byte("shopinfo"))
}),
),
beego.NSNamespace("/order",
beego.NSGet("/:id", func(ctx *context.Context) {
ctx.Output.Body([]byte("orderinfo"))
}),
),
beego.NSNamespace("/crm",
beego.NSGet("/:id", func(ctx *context.Context) {
ctx.Output.Body([]byte("crminfo"))
}),
),
)
For more information please check namespace
有关更多信息,请检查命名空间
Annotation Router 注释路由器
// CMS API
type CMSController struct {
beego.Controller
}
func (c *CMSController) URLMapping() {
c.Mapping("StaticBlock", c.StaticBlock)
c.Mapping("AllBlock", c.AllBlock)
}
// @router /staticblock/:key [get]
func (this *CMSController) StaticBlock() {
}
// @router /all/:key [get]
func (this *CMSController) AllBlock() {
}
Automated API Document 自动 API 文档
Automated document is a very cool feature that I wish to have. Now it became real in Beego. As I said Beego will not only boost the development of API but also make the API easy to use for the user.
自动文档是我希望拥有的一个非常酷的功能。现在它在 Beego 中成为现实。如我所说,Beego 不仅会促进 API 的开发,还会让用户更轻松地使用 API。 API 文档可以由注释自动生成,并可以在线测试。
The API document can be generated by annotations automatically and can be tested online.
有关更多信息,请检查自动文档 config 支持不同的运行模式 您可以在其自己的部分下为不同的运行模式设置配置。默认情况下,Beego 将采用当前运行模式的配置。例如: 上面的配置为 dev、prod 和 test 环境设置了 httpport。Beego 将采用 httpport = 8080 作为当前运行模式“dev”。
For more information please check Automated Document
config supports different Runmode
You can set configurations for different Runmode under their own sections. Beego will take the configurations of current Runmode by default. For example:
appname = beepkg
httpaddr = "127.0.0.1"
httpport = 9090
runmode ="dev"
autorender = false
autorecover = false
viewspath = "myview"
[dev]
httpport = 8080
[prod]
httpport = 8088
[test]
httpport = 8888
The configurations above set up httpport for dev, prod and test environment. Beego will take httpport = 8080 for current runmode “dev”.
Support Two Way Authentication for SSL 支持 SSL 的双向认证
config := tls.Config{
ClientAuth: tls.RequireAndVerifyClientCert,
Certificates: []tls.Certificate{cert},
ClientCAs: pool,
}
config.Rand = rand.Reader
beego.BeeApp.Server.TLSConfig = &config
beego.Run supports parameter beego.Run 支持参数
beego.Run()
Run on HttpPort
by default
beego.Run()
默认在 HttpPort
上运行
beego.Run(":8089")
beego.Run("127.0.0.1:8089")
Increased XSRFKEY token from 15 characters to 32 characters. 将 XSRFKEY 令牌从 15 个字符增加到 32 个字符。
Removed hot reload 移除了热重载
Template function supports Config. Get Config value from Template easily. 模板函数支持 Config。轻松从模板获取 Config 值。
{{config returnType key defaultValue}}
{{config "int" "httpport" 8080}}
httplib supports cookiejar. Thanks to curvesft httplib 支持 cookiejar。感谢 curvesft
orm suports time format. If empty return nil other than 0000.00.00 Thanks to JessonChan orm 支持时间格式。如果为空则返回 nil,而不是 0000.00.00。感谢 JessonChan
config module supports parsing a json array. Thanks to chrisport config 模块支持解析 json 数组。感谢 chrisport
bug fix 错误修复
- Fixed static folder infinite loop 修复静态文件夹无限循环
- Fixed typo 修复错别字
Beego 1.2.0
Hi guys! After one month of hard work, we released the new awesome version 1.2.0. Beego is the fastest Go framework in the latest Web Framework Benchmarks already though our goal is to make Beego the best and easiest framework to use. In this new release, we improved even more in both usability and performance which is closer to native Go.
大家好!经过一个月的努力工作,我们发布了新的 1.2.0 版本。Beego 是最新的 Web 框架基准测试中最快的 Go 框架,尽管我们的目标是让 Beego 成为最棒且最易用的框架。在此新版本中,我们在可用性和性能方面进行了更多改进,更接近原生 Go。
New Features: 新功能:
1. namespace
Support 1. namespace
支持
beego.NewNamespace("/v1").
Filter("before", auth).
Get("/notallowed", func(ctx *context.Context) {
ctx.Output.Body([]byte("notAllowed"))
}).
Router("/version", &AdminController{}, "get:ShowAPIVersion").
Router("/changepassword", &UserController{}).
Namespace(
beego.NewNamespace("/shop").
Filter("before", sentry).
Get("/:id", func(ctx *context.Context) {
ctx.Output.Body([]byte("notAllowed"))
}))
The code above supports the URL requests below:
上面的代码支持以下 URL 请求:
GET /v1/notallowed
GET /v1/version
GET /v1/changepassword
POST /v1/changepassword
GET /v1/shop/123
namespace` also supports pre-filters, conditions checking and unlimited nested `namespace
namespace
还支持预过滤器、条件检查和无限嵌套 namespace
2. Supporting more flexible router modes 2. 支持更灵活的路由器模式
Custom functions from RESTful router
RESTful 路由器的自定义函数
beego.Get(router, beego.FilterFunc)
beego.Post(router, beego.FilterFunc)
beego.Put(router, beego.FilterFunc)
beego.Head(router, beego.FilterFunc)
beego.Options(router, beego.FilterFunc)
beego.Delete(router, beego.FilterFunc)
beego.Get("/user", func(ctx *context.Context) {
ctx.Output.Body([]byte("Get userlist"))
})
More flexible Handler
更灵活的 Handler
beego.Handler(router, http.Handler)
Integrating other services easily
轻松集成其他服务
import (
"http"
"github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
)
func init() {
s := rpc.NewServer()
s.RegisterCodec(json.NewCodec(), "application/json")
s.RegisterService(new(HelloService), "")
beego.Handler("/rpc", s)
}
3. Binding request parameters to object directly 3. 将请求参数直接绑定到对象
For example: this request parameters
例如:此请求参数
?id=123&isok=true&ft=1.2&ol[0]=1&ol[1]=2&ul[]=str&ul[]=array&user.Name=astaxie
var id int
ctx.Input.Bind(&id, "id") //id ==123
var isok bool
ctx.Input.Bind(&isok, "isok") //isok ==true
var ft float64
ctx.Input.Bind(&ft, "ft") //ft ==1.2
ol := make([]int, 0, 2)
ctx.Input.Bind(&ol, "ol") //ol ==[1 2]
ul := make([]string, 0, 2)
ctx.Input.Bind(&ul, "ul") //ul ==[str array]
user struct{Name}
ctx.Input.Bind(&user, "user") //user =={Name:"astaxie"}
4. Optimized the form parsing flow and improved the performance 4. 优化表单解析流程并提高性能
5. Added more testcases 5. 添加更多测试用例
6. Added links for admin monitoring module 6. 添加了用于管理监控模块的链接
7. supporting saving struct into session 7. 支持将结构保存到会话中
8.httplib supports file upload interface 8.httplib 支持文件上传接口
b:=httplib.Post("http://beego.wiki/")
b.Param("username","astaxie")
b.Param("password","123456")
b.PostFile("uploadfile1", "httplib.pdf")
b.PostFile("uploadfile2", "httplib.txt")
str, err := b.String()
if err != nil {
t.Fatal(err)
}
httplib
also supports custom protocol version
httplib
还支持自定义协议版本
9. ORM supports all the unexport fields of struct 9. ORM 支持 struct 的所有 unexport 字段
10. Enable XSRF in controller level. XSRF can only be controlled in the whole project level. However, you may want to have more control for XSRF, so we let you control it in Prepare function in controller level. Default is true which means using the global setting. 10. 在控制器级别启用 XSRF。XSRF 只能在整个项目级别进行控制。但是,您可能希望对 XSRF 有更多控制权,因此我们允许您在控制器级别的 Prepare 函数中进行控制。默认值为 true,表示使用全局设置。
func (a *AdminController) Prepare(){
a.EnableXSRF = false
}
11. controller supports ServeFormatted function which supports calling ServeJson or ServeXML based on the request’s Accept 11. 控制器支持 ServeFormatted 函数,该函数支持根据请求的 Accept 调用 ServeJson 或 ServeXML
12. session supports memcache engine 12. 会话支持 memcache 引擎
13. The Download function of Context supports custom download file name 13. Context 的 Download 函数支持自定义下载文件名
Bug Fixes 错误修复
- Fixed the bug that session’s Cookie engine can’t set expiring time 修复了会话的 Cookie 引擎无法设置过期时间的错误
- Fixed the bug of saving and parsing flash data 修复了保存和解析 flash 数据的错误
- Fixed all the problems of
go vet
修复了go vet
的所有问题 - Fixed the bug of ParseFormOrMulitForm 修复了 ParseFormOrMulitForm 的错误
- Fixed the bug that only POST can parse raw body. Now all the requests except GET and HEAD support raw body. 修复了只有 POST 才能解析原始正文的错误。现在除了 GET 和 HEAD 之外的所有请求都支持原始正文。
- Fixed the bug that config module can’t parse
xml
andyaml
修复了 config 模块无法解析xml
和yaml
的错误
Beego 1.1.4
This is an emergency release for solving a serious security problem. Please update to the latest version! By the way released all changes together.
这是一个紧急版本,用于解决一个严重的安全性问题。请更新到最新版本!顺便一起发布了所有更改。
fixed a security problem. I will show the details in beego/security.md later.
修复了一个安全性问题。我稍后会在 beego/security.md 中显示详细信息。
statifile
move to new file.
statifile
移至新文件。move dependence of the third libs,if you use this module in your application: session/cache/config, please import the submodule of the third libs:
移动第三方库的依赖项,如果您在应用程序中使用此模块:session/cache/config,请导入第三方库的子模块:
import ( "github.com/beego/beego/v2" _ "github.com/beego/beego/v2/session/mysql" )
modify some functions to private.
将一些函数修改为私有。
improve the FormParse.
改进了 FormParse。
released date: 2014-04-08
发布日期:2014-04-08
Beego 1.1.3
this is a hot fixed:
这是一个热修复:
console engine for logs.It will not run if there’s no config.
日志的控制台引擎。如果无配置,它将不会运行。
Beego 1.1.2 support
go run main.go
, but ifmain.go
bot abute the Beego’s project rule,use own AppConfigPath or not exist app.conf will panic. Beego 1.1.2 支持
go run main.go
,但如果main.go
机器人滥用 Beego 的项目规则,使用自己的 AppConfigPath 或不存在 app.conf 将会引发恐慌。Beego 1.1.2 supports
go test
parse config,but actually when call TestBeegoInit still can’t parseconfig Beego 1.1.2 支持
go test
分析配置,但实际上在调用 TestBeegoInit 时仍然无法分析配置
released date: 2014-04-04
发布日期:2014-04-04
Beego 1.1.2
The improvements:
改进之处:
- Added ExceptMethodAppend fuction which supports filter out some functions while run autorouter 添加了 ExceptMethodAppend 函数,该函数支持在运行自动路由器时过滤掉某些函数
- Supporting user-defined FlashName, FlashSeperator 支持用户定义的 FlashName、FlashSeperato
- ORM supports user-defined types such as type MyInt int ORM 支持用户自定义类型,如 type MyInt int
- Fixed validation module return user-defined validating messages 修复验证模块返回用户自定义验证消息
- Improved logs module, added Init processing errors. Changed some unnecessory public function to private 改进日志模块,添加 Init 处理错误。将一些不必要的公共函数更改为私有函数
- Added PostgreSQL engine for session module 为会话模块添加 PostgreSQL 引擎
- logs module supports output caller filename and line number. Added EnableFuncCallDepth function, closed by default. 日志模块支持输出调用者文件名和行号。添加 EnableFuncCallDepth 函数,默认情况下关闭。
- Fixed bugs of Cookie engine in session module 修复会话模块中 Cookie 引擎的 bug
- Improved the error message for templates parsing error 改进了模板解析错误的错误消息
- Allowing modifing Context by Filter to skip Beego’s routering rules and using uder-defined routering rules. Added parameters RunController and RunMethod 允许 Filter 修改 Context 以跳过 Beego 的路由规则并使用用户定义的路由规则。添加参数 RunController 和 RunMethod
- Supporting to run Beego APP by using
go run main.go
支持使用go run main.go
运行 Beego APP - Supporting to run test cases by using
go test
. Added TestBeegoInit function. 支持使用go test
运行测试用例。添加 TestBeegoInit 函数。
released date: 2014-04-03
发布日期:2014-04-03
Beego 1.1.1
Added some new features and fixed some bugs in this release.
此版本中添加了一些新功能并修复了一些错误。
- File engine can’t delete file in session module which will raise reading failure. 文件引擎无法删除会话模块中的文件,这将引发读取失败。
- File cache can’t read struct. Improved god automating register 文件缓存无法读取结构。 改进了 god 自动注册
- New couchbase engine for session module 会话模块的新 couchbase 引擎
- httplib supports transport and proxy httplib 支持传输和代理
- Improved the Cookie function in context which support httponly by default as well as some other default parameters. 改进了 context 中的 Cookie 函数,默认情况下支持 httponly 以及其他一些默认参数。
- Improved validation module to support different cellphone No. 改进了验证模块以支持不同的手机号码。
- Made getstrings function to as same as getstring which doesn’t need parseform 使 getstrings 函数与 getstring 相同,无需 parseform
- Redis engine in session module will return error while connection failure 会话模块中的 Redis 引擎在连接失败时将返回错误
- Fixed the bug of unable to add GroupRouters 修复了无法添加 GroupRouters 的错误
- Fixed the bugs for multiple static files, routes matching bug and display the static folder automatically 修复了多个静态文件、路由匹配错误以及自动显示静态文件夹的错误
- Added GetDB to get connected *sql.DB in ORM 添加了 GetDB 以在 ORM 中获取已连接的 *sql.DB
- Added ResetModelCache for ORM to reset the struct which has already registered the cache in order to write tests easily 为 ORM 添加了 ResetModelCache,以重置已注册缓存的结构,以便轻松编写测试
- Supporting between in ORM 支持 ORM 中的 between
- Supporting sql.Null* type in ORM 支持 ORM 中的 sql.Null* 类型
- Modified auto_now_add which will skip time setting if there is default value. 修改了 auto_now_add,如果存在默认值,它将跳过时间设置。
released date: 2014-03-12
发布日期:2014-03-12
Beego 1.1.0
Added some new features and fixed some bugs in this release.
此版本中添加了一些新功能并修复了一些错误。
New features
新功能
- Supporting AddAPPStartHook function 支持 AddAPPStartHook 函数
- Supporting plugin mode; Supporting AddGroupRouter for configuring plugin routes. 支持插件模式;支持 AddGroupRouter 以配置插件路由。
- Response supporting HiJacker interface 响应支持 HiJacker 接口
- AddFilter supports batch matching AddFilter 支持批量匹配
- Refactored session module, supporting Cookie engine 重构会话模块,支持 Cookie 引擎
- Performance benchmark for ORM ORM 的性能基准
- Added strings interface for config which allows configuration 为允许配置的 config 添加字符串接口
- Supporting template render control in controller level 支持控制器级别的模板渲染控件
- Added basicauth plugin which can implement authentication easily 添加了可以轻松实现身份验证的基本身份验证插件
- #436 insert multiple objects #436 插入多个对象
- #384 query map to struct #384 查询映射到结构
bugfix
错误修复
- Fixed the bug of FileCache 修复了 FileCache 的错误
- Fixed the import lib of websocket 修复了 websocket 的导入库
- Changed http status from 200 to 500 when there are internal error. 当出现内部错误时,将 http 状态从 200 更改为 500。
- gmfim map in memzipfile.go file should use some synchronization mechanism (for example sync.RWMutex) otherwise it errors sometimes. memzipfile.go 文件中的 gmfim 映射应使用某种同步机制(例如 sync.RWMutex),否则有时会出错。
- Fixed #440 on_delete bug that not getting delted automatically 修复了 #440 on_delete 错误,该错误不会自动删除
- Fixed #441 timezone bug 修复了 #441 时区错误
released date: 2014-02-10
发布日期:2014-02-10
Beego 1.0 release Beego 1.0 发布
After four months code refactoring, we released the first stable version of Beego. We did a lot of refactoring and improved a lot in detail. Here is the list of the main improvements:
经过四个月的代码重构,我们发布了 Beego 的第一个稳定版本。我们做了很多重构,并在细节上做了很多改进。以下是主要改进列表:
Modular design. Right now Beego is a light weight assembling framework with eight powerful stand alone modules including cache, config, logs, sessions, httplibs, toolbox, orm and context. It might have more in the future. You can use all of these stand alone modules in your other applications directly no matter it’s web applications or any other applications such as web games and mobile games.
模块化设计。现在 Beego 是一个轻量级的组装框架,具有八个强大的独立模块,包括缓存、配置、日志、会话、httplibs、工具箱、orm 和上下文。未来可能会更多。您可以在其他应用程序中直接使用所有这些独立模块,无论它是 Web 应用程序还是任何其他应用程序,例如网络游戏和手机游戏。
Supervisor module. In the real world engineering, after the deployment of the application, we need to do many kinds of statistics and analytics for the application such as QPS statistics, GC analytics, memory and CPU monitoring and so on. When the live issue happends we also want to debug and profile our application on live. All of these real world engineering features are included in Beego. You can enable the supervisor module in Beego and visit it from default port 8088.
Supervisor 模块。在现实世界的工程中,在应用程序部署后,我们需要对应用程序执行多种统计和分析,例如 QPS 统计、GC 分析、内存和 CPU 监视等。当实时问题发生时,我们还希望在实时环境中调试和分析我们的应用程序。所有这些现实世界的工程功能都包含在 Beego 中。您可以在 Beego 中启用 Supervisor 模块,并从默认端口 8088 访问它。
Detailed document. We rewritten all the document. We improved the document based on many advices from the users. To make it communicate easier for different language speakers, now the comments of the document in each language are separated.
详细文档。我们重写了所有文档。我们根据许多用户的建议改进了文档。为了让不同语言的使用者更容易交流,现在文档中的注释以每种语言分开。
Demos. We provided three examples, chat room, url shortener and todo list. You can understand and use Beego easier and faster by learning the demos.
演示。我们提供了三个示例,聊天室、网址缩短器和待办事项列表。通过学习这些演示,您可以更容易、更快速地理解和使用 Beego。
Redesigned Beego website. Nice people from Beego community helped Beego for logo design and website design.
重新设计了 Beego 网站。Beego 社区的热心人士帮助 Beego 设计了徽标和网站。
More and more users. We listed our typical users in our homepage. They are all big companies and they are using Beego for their products already. Beego already tested by those live applications.
越来越多的用户。我们在主页上列出了我们的典型用户。他们都是大公司,并且已经在为他们的产品使用 Beego。Beego 已经通过这些实时应用程序进行了测试。
Growing active communities. There are more than 390 issues on github, more than 36 contributors and more than 700 commits. Google groups is also growing.
不断壮大的活跃社区。在 github 上有超过 390 个问题、超过 36 个贡献者和超过 700 次提交。Google 群组也在不断壮大。
More and more applications in Beego. There are some open source applications as well. E.g.: CMS system: https://github.com/insionng/toropress and admin system: https://github.com/beego/admin
Beego 中的应用程序越来越多。还有一些开源应用程序。例如:CMS 系统:https://github.com/insionng/toropress 和管理系统:https://github.com/beego/admin
Powerful assistance tools. bee is used to assist the development of Beego applications. It can create, compile, package the Beego application easily.
强大的辅助工具。bee 用于辅助 Beego 应用程序的开发。它可以轻松地创建、编译和打包 Beego 应用程序。
released date: 2013-12-19
发行日期:2013-12-19