Release Notes
beego 2.0.4
Note: now we force the web admin service serving HTTP only.
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.
But the checksum in sum.golang.cn is immutable, so we release this version
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.
- Add
adapter
module which is used to reduce the effort of upgrading Beego from v1.x to v2.x - Add
context.Context
forcache
,httplib
,session
,task
,ORM
modules’ API. - Add
error
as a return value forcache
,httplib
,session
,task
. Now users are able to know more info about what happen inside Beego. - Decouple modules from each other. All modules only depend on
core
package. - Support tracing, metrics in ORM, web, httplib modules.
- Introduce
filter-chain
patter to support AOP.
Feature:
- Allow Healthcheck endpoint return JSON for Kubernetes. 4055
- Support
ClientAuth
for TLS. 4116 orm.RawSeter
supportsorm.Fielder
. 4191- Add a new MySQL operator for strict case-sensitive query. 4198
- Using
filter-chain
pattern inorm
module. Support opentracing and prometheus by using filter. 4141 - Support
prometheus
filter forhttplib
module. 4145 - Add additional options to redis session prov. 4137
- Support default value filter for
orm
module. 4156 - Add methods
Unmarshaler
,Sub
,OnChange
forConfiger
module. 4175 - Custom Log Formatter. 4174, 4179, 4188
- Support the time precision for time.Time type. 4186
- Support
etcd
in Config module. 4195 - Optimize rawSet.QueryRows to avoid many unnecessary calls to parseStructTag. 4210
- Allow users to ignore some table when run ORM commands. 4211
- PostgresQueryBuilder 4205
- Provides a powerful
LogFormatter
implementation PatternLogFormatter.4229 - Support custom ES index name. 4233
- Support multiple web servers. 4234
- Support toml config. 4262
- Using unmarshaler to parse config in web module. 4266
- Add MaxUploadFile to provide more safety uploading control. 4275
- Support using json string to init session. 4277
- Support global instance for config module. 4278
- Session: adds CookieSameSite to ManagerConfig. 4226
Fix:
- Fix reconnection bug in logs/conn.go. 4056
- Return 413 when request payload too large. 4058
- Fix
index out of range
in session module whenlen(sid) < 2
. 4068 - Fix concurrent issue of context/input Query method. 4066
- Allow using environment variable to specific the config file. 4111
- XSRF add secure and http only flag. 4126
- Fix temporary create failed on Windows 4244
- Fix:return error after inserting data when primary key is string. 4150
- Fix the bug that Fielder’s SetRaw is not called when calling orm.Raw() to query from database. 4160
- Fix: return error when calling
InsertOrUpdate
is successful with string primary key. 4158 - Fix the problem that the nested structure of queryRow() cannot assign values 4173
- Empty field in validator.Error when label struct tag is not declared. 4225
- Fix deadlock in task module. 4246
- Fix: form entity too large casue run out of memory. 4272
Doc:
beego 1.12.3
Feature:
- Allow Healthcheck endpoint return JSON for Kubernetes. 4055
- Support
ClientAuth
for TLS. 4116 orm.RawSeter
supportorm.Fielder
. 4191- Add a new MySQL operator for strict case sensitive query. 4198
Fix:
- Fix reconnection bug in logs/conn.go. 4056
- Return 403 when request payload too large. 4058
- Fix race condition for Prepare Statement cache. 4061
- Fix
index out of range
in session module whenlen(sid) < 2
. 4068 - Fix concurrent issue of context/input Query method. 4066
- Allow using environment variable to specific the config file. 4111
- XSRF add secure and http only flag. 4126
- Fix temporary create failed on Windows 4244
- Session: adds CookieSameSite to ManagerConfig. 4226
- Make stmt cache smaller to avoid
too many statement
error. 4261
beego 1.12.2
- Fix old process didn’t exist when graceful restart in beego 1.12.0 #4005
- Enhance: Print stack while orm abnormally exit #3743
- Enhance: Replacing lock with read lock in GetMapData #3803
- Fix: Get the real location of the log directory if the path is symbolic path #3818
- Fix: Cache, context, session: add lock to fix inconsistent field protection #3922
- Fix: Encoded url(with slash) router mismatch problem #3943
- Fix: genRouterCode method generate wrong codes #3981
- Enhance: Using LRU algorithm, ignoring big file and using max cache size to reduce the memory usage of file cache #3984
- Fix: Set max DB connections #3985
- Fix: SQLite don’t support SELECT … FOR UPDATE #3992
- Enhance: Add Transfer-Encoding header in httplib’s PostFile method #3993
- Enhance: Support bit operation in 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
- Fix: Empty field in validator.Error when label struct tag is not declared #4001
- Fix: panic: send on closed channel after closing logger #4004
- Enhance: Store RouterPattern before filter execute #4007
- Fix: Using HTMLEscapeString in adminui.go to avoid XSS attack #4018
- Fix: Process not closed when graceful set to true #4005
- Enhance: Use scan instead of keys in redis #4016
- Feature: Support prometheus #4021
- Fix: Can’t create more than max_prepared_stmt_count statements #4025
- Enhance: Support more mobile number pattern #4027
- Fix: Can’t set section name #4027
- Fix: strings.Repeat panic in orm/db.go #4032
- Enhance: Make redis client idle timeout configurable #4033
beego 1.10.0
- Update log.go add GetLevel Function to Log #2970
- Fix a typo “conflict” #2971
- Bug on private fields #2978
- Fix access log console unexpected ‘\n’ at end of each log. #2976
- Fix Documentation for HTTP status codes descriptions. #2992
- Redis cache: make MaxIdle configurable #3004
- Update: Fix migration generate SQL #3017
- Handle pointer validation #3046
- Fix the issue TaseCase TestFormatHeader_0 is failed #3066
- Fix BEEGO_RUNMODE #3064
- Swagger: Allow example values with different types, allow example for enum. #3085
- Fix the bug: unable to add column with ALTER TABLE #2999
- Set default Beego RunMode to production #3076
- Fix typo #3103
- In dev mode, template parse error cause program lock #3126
- Amend a very minor typo in a variable name #3115
- When log maxSize set big int,FileWrite Init fail #3109
- Change github.com/garyburd/redigo to newest branch github.com/gomodul… #3100
- ExecElem.FieldByName as local variable #3039
- Allow log prefix #3145
- Refactor yaml config for support multilevel #3127
- Create redis_cluster.go #3175
- Add field comment on create table #3190
- Update: use PathEscape replace QueryEscape #3200
- Update gofmt #3206
- Update: Htmlquote Htmlunquote #3202
- Add ‘FOR UPDATE’ support for querySet #3208
- Debug stringsToJSON #3171
- Fix defaut value bug, and add config for maxfiles #3185
- Fix: correct MaxIdleConnsPerHost value to net/http default 100. #3230
- Fix: When multiply comment routers on one func #3217
- Send ErrNoRows if the query returns zero rows … in method orm_query… #3247
- Fix typo #3245
- Add session redis IdleTimeout config #3239
- Fix the wrong status code in prod #3226
- Add method to set the data depending on the accepted #3182
- Fix Unexpected EOF bug in staticfile #3152
- Add code style for logs README #3146
- Fix response http code #3142
- Improve access log #3141
- Auto create log dir #3105
- Html escape before display path, avoid xss #3022
- Acquire lock when access config data #3250
- Fix orm fields SetRaw function error judge problem #2985
- Fix template rendering with automatic mapped parameters (see #2979) #2981
- Fix the model can not be registered correctly on Ubuntu 32bit #2997
- Feature/yaml #3181
- Feature/autocert #3249
beego 1.9.0
- Fix the new repo address for casbin #2654
- Fix cache/memory fatal error: concurrent map iteration and map write #2726
- AddAPPStartHook func modify #2724
- Fix panic: sync: negative WaitGroup counter #2717
- incorrect error rendering (wrong status) #2712
- validation: support int64 int32 int16 and int8 type #2728
- validation: support required option for some struct tag valids #2741
- Fix big form parse issue #2725
- File log add RotatePerm #2683
- Fix Oracle placehold #2749
- Supported gzip for req.Header has Content-Encoding: gzip #2754
- Add new Database Migrations #2744
- Beego auto generate sort ControllerComments #2766
- added statusCode and pattern to FilterMonitorFunc #2692
- fix the bugs in the “ParseBool” function in the file of config.go #2740
bee 1.9.0
- Added MySQL year data type #443
- support multiple http methods #445
- The DDL migration can now be generated by adding a -ddl and a proper “alter” or “create” as argument value. #455
- Fix: docs generator skips everything containing ‘vendor’ #454
- get these tables information in custom the option #441
- read ref(pk) #444
- Add command bee server to server static folder.
beego 1.7.1
New features:
- Added IP for access log #2156
- ReadForUpdate or ORM #2158
- Parameters binding supports form,columns[0].Data=foo&columns[1].Data=bar&columns[2].Data=baz #2111
- Added
beego.BConfig.RecoverFunc
for custom recover method. #2004 - memcache cache supports byte and string. So as to cache struct by gob#1521
- ORM delete by condition. #1802
- swagger doc supports yaml #2162
- Added RunController and RunMethod for customized router rules #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
- Time in Beego admin UI displayed alphabetically other than ordered by us or ms. #1877
- Crash while captcha generates by custom height and width. #2161
- Panic while empty body requested with DELETE method when CopyBody enabled. #1656
beego 1.7.0
New features:
- Improved Filter speed by 7.5+ times #1799
- Multiple level for Gzip compression #1808
- Negative numbers for ORM PK #1810
- Custom auto-increasing ID for ORM #1826
- Improved Context file downloading: check file existence before download#1827
GetLogger
method for log module #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
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
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.
bugfix:
/m
redirect to/m/
automatically in static reouters. #1792- Parsing config file error while testing #1794
- Race condition while rotate file. #1803
- Fixed multiple response.WriteHeader calls error. #1805
- Fixed panic if primary key is uint in ORM #1828
- Fixed panic if current time is less than 2000 while rotate logs. #
- Fixed XSRF reuse caused by context reuse.#1863
- Panic while InsertMulti * type in ORM #1882
- Multiple execution of task in a very short time. #1909
- Garbled file name in IE #1912
- ORM DISTINCT #1938
- Can’t use int while setting file permit in Logs module. #1948 #2003
- Empty foreign key for QueryRow and QueryRows. #1964
- Retrieving scheme from X-Forwarded-Proto when it isn’t none. #2050
- Add query parameters for redirecting static path to
path/
#2064
beego 1.6.1
New features
- Oracle driver for ORM
- inline mode for ORM Model
- ssdb engine for Cache
- Color scheme configure for console out
- travis integration
- mulitfile engine for Log. Write logs from different levels to different files.
bugfix:
- cookie time config
- Router rule mapping #1580
- No logs before beego.Run()
- Returning nil while []string is empty in config
- Wrong comment for ini engine
- Log time delay while store log asynchronously
- Config file parsed twice.
- Can’t handle
()
in URL for regex router. - Chinese encoding issue in mail
- No Distinct in ORM
- Compiling error in Layout
- Wrong file name in logrotate
- Invalid CORS if CORS plugin fail.
- Conflicting between path params and router params in filters
- Return 404 other than 200 if static files are not found.
- Added GroupBy interface
- Static file crush caused by accessing map concurrently of Go 1.6
- Extra newline output by json.Encoder of JSONBody in httplib
- Missing log when Close if use flush in log under asynchronous mode.
beego 1.6.0
New features:
log
supports rotating files likexx.2013-01-01.2.log
#1265context.response
supports Flush, Hijack, CloseNotify- ORM supports Distinct #1276
map_get
template method #1305- ORM supports tidb engine #1366
- httplib request supports []string #1308
- ORM
querySeter
addedGroupBy
method #1345 - Session’s MySQL engine supports custom table name #1348
- Performance of log’s file engine improved 30%; Supports set log file’s permission #1560
- Get session by query #1507
- Cache module supports multiple Cache objects.
- validation supports custom validation functions
bugfix:
bind
method incontext
caused crash when parameter is empty. #1245- manytomany in ORM reverse error #671
- http: multiple response.WriteHeader calls #1329
- ParseForm uses local timezone while parsing date #1343
- Emails sent by log’s SMTP engine can’t be authorised
- Fixed some issues in router:
/topic/:id/?:auth
,/topic/:id/?:auth:int
#1349 - Fixed the crash caused by nil while parsing comment documentation. #1367
- Can’t read
index.html
in static folder dbBase.Update
doesn’t return err if failed #1384Required
invalidation
only works for int but not for int64- orm: Fix handling of rel(fk) to model with string pk #1379
- graceful error while both http and https enabled #1414
- If ListenTCP4 enabled and httpaddr is empty, it still listens TCP6
- migration doesn’t support postgres #1434
- Default values of ORM text, bool will cause error while creating tables.
- graceful panic: negative WaitGroup counter
Improvement:
- Moved example to samples
- Passed golint
- Rewrote router, improved performance by 3 times.
- Used
sync.Pool
forcontext
to improve performance - Improved template compiling speed. #1298
- Improved config
- Refactored whole codebase for readability and maintainability
- Moved all init code into
AddAPPStartHook
- Removed
middleware
. Will only useplugins
- Refactored
Error
handling.
Beego 1.5.0
New Features:
- Graceful shutdown
- Added
JsonBody
method tohttplib
which supporting sending raw body as JSON format - Added
AcceptsHtml
AcceptsXml
AcceptsJson
methods tocontext input
- Get config files from Runmode first
httplib
supportsgzip
log
module stop using asynchronous mode by defaultvalidation
supports recursion- Added
apk mime
ORM
supportseq
anne
Bugfixes:
- Wrong parameters for ledis driver.
- When user refresh the page after the captcha code expired from the cache, it returns 404. Generating new captcha code for reloading.
- Controller defines Error exception
- cookie doesn’t work in window IE
- GetIn returns nil error while getting non-exist variable
- More cellphone validation code
- Wrong router matching
- The
panic
returns http 200 - The database setting erros caused by redis session
- The issue that https and http don’t share session
- Memcache session driver returns error if it’s empty
Beego 1.4.3
New Features:
- ORM support default settting
- improve logs/file line count
- sesesion ledis support select db
- session redis support select db
- cache redis support select db
UrlFor
support all type of the parameters- controller
GetInt/GetString
function support default value, like:GetInt("a",12)
- add
CompareNot/NotNil
template function - support Controller defeine error,controller Error
ParseForm
support slices of ints and strings- improve ORM interface
bugfix:
- context get wrong subdomain
beego.AppConfig.Strings
when the strings is empty, always return[]string{}
- utils/pagination can’t modify the attributes
- when the request url is empty, route tree crashes
- can’t click the link to run the task in adminui
- FASTCGI restart didn’t delete the unix Socket file
Beego 1.4.2
New Features:
-
Added SQL Constructor inspired by ZEND ORM.
-
Added
GetInt()
,GetInt8()
,GetInt16()
,GetInt32()
,GetInt64()
for Controller. -
Improved the logging. Added
FilterHandler
for filter logging output. -
Static folder supports
index.html
. Automatically adding/
for static folders. -
flash
supportssuccess
andset
methods. -
Config for ignoring case for routers:
RouterCaseSensitive
. Case sensitive by default. -
Configs load based on environment:
beego.AppConfig.String("myvar")
return 456 on dev mode and return 123 on the other modes.runmode = dev myvar = 123 [dev] myvar = 456
-
Added
include
forini
config files:appname = btest include b.conf
-
Added
paginator
utils. -
Added
BEEGO_RUNMODE
environment variable. You can change the application mode by changing this environment variable. -
Added Json function for fetching
statistics
intoolbox
. -
Attachements support for mail utils.
-
Turn on fastcgi by standard IO.
-
Using
SETEX
command to support the old version redis in redis Session engine. -
RenderForm supports html id and class by using id and class tag.
-
ini config files support BOM head.
-
Added new Session engine
ledis
. -
Improved file uploading in
httplib
. Supporting extremely large files by usingio.Pipe
. -
Binding to TCP4 address by default. It will bind to ipv6 in GO. Added config variable
ListenTCP4
. -
off/on/yes/no/1/0 will parse to
bool
in form rendering. Support time format. -
Simplify the generating of SeesionID. Using golang buildin
rand
function other thanhmac_sha1
.
bugfix:
- XSRF verification failure while
PUT
andDELETE
cased by lowercased_method
- No error message returned while initialize the cache by
StartAndGC
- Can’t set
User-Agent
inhttplib
- Improved
DelStaticPath
- Only finding files in the first static folder when using multiple static folders
Filter
functions can’t execute afterAfterExec
andFinishRouter
- Fixed uninitialized mime
- Wrong file name and line number in the log
- Can’t send the request while only uploading one file in
httplib
- Improved the
Abort
output message. It couldn’t out undefined error message before. - Fixed the issue that can’t add inner Filter while no out Filter set in the nested
namespaces
- Router mapping error while router has multiple level parameters. #824
- The information lossing while having many
namespaces
for the commented router. #770 urlfor
function calling useless {{placeholder}} #759
Beego 1.4.1
New features:
context.Input.Url
get path info without domain scheme.- Added plugin
apiauth
to simulate theAWS
encrypted requests. - Simplified the debug output for router info.
- Supportting pointer type in ORM.
- Added
BasicAuth
, cache for multiple requests
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
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.
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)
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
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.
The API document can be generated by annotations automatically and can be tested online.
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
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()
Run on HttpPort
by default
beego.Run(":8089")
beego.Run("127.0.0.1:8089")
Increased XSRFKEY token from 15 characters to 32 characters.
Removed hot reload
Template function supports Config. Get Config value from Template easily.
{{config returnType key defaultValue}}
{{config "int" "httpport" 8080}}
httplib supports cookiejar. Thanks to curvesft
orm suports time format. If empty return nil other than 0000.00.00 Thanks to JessonChan
config module supports parsing a json array. Thanks to 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.
New Features:
1. namespace
Support
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:
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
2. Supporting more flexible router modes
Custom functions from RESTful router
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
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
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
5. Added more testcases
6. Added links for admin monitoring module
7. supporting saving struct into session
8.httplib supports file upload interface
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
9. ORM supports all the unexport fields of struct
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.
func (a *AdminController) Prepare(){
a.EnableXSRF = false
}
11. controller supports ServeFormatted function which supports calling ServeJson or ServeXML based on the request’s Accept
12. session supports memcache engine
13. The Download function of Context supports custom download file name
Bug Fixes
- Fixed the bug that session’s Cookie engine can’t set expiring time
- Fixed the bug of saving and parsing flash data
- Fixed all the problems of
go vet
- Fixed the bug of ParseFormOrMulitForm
- Fixed the bug that only POST can parse raw body. Now all the requests except GET and HEAD support raw body.
- Fixed the bug that config module can’t parse
xml
andyaml
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.
-
statifile
move to new file. -
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:
import ( "github.com/beego/beego/v2" _ "github.com/beego/beego/v2/session/mysql" )
-
modify some functions to private.
-
improve the FormParse.
released date: 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 supports
go test
parse config,but actually when call TestBeegoInit still can’t parseconfig
released date: 2014-04-04
Beego 1.1.2
The improvements:
- Added ExceptMethodAppend fuction which supports filter out some functions while run autorouter
- Supporting user-defined FlashName, FlashSeperator
- ORM supports user-defined types such as 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
- Added PostgreSQL engine for session module
- logs module supports output caller filename and line number. Added EnableFuncCallDepth function, closed by default.
- Fixed bugs of Cookie engine in session module
- 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
- Supporting to run Beego APP by using
go run main.go
- Supporting to run test cases by using
go test
. Added TestBeegoInit function.
released date: 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
- New couchbase engine for session module
- httplib supports transport and proxy
- Improved the Cookie function in context which support httponly by default as well as some other default parameters.
- Improved validation module to support different cellphone No.
- Made getstrings function to as same as getstring which doesn’t need parseform
- Redis engine in session module will return error while connection failure
- Fixed the bug of unable to add 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
- Added ResetModelCache for ORM to reset the struct which has already registered the cache in order to write tests easily
- Supporting between in ORM
- Supporting sql.Null* type in ORM
- Modified auto_now_add which will skip time setting if there is default value.
released date: 2014-03-12
Beego 1.1.0
Added some new features and fixed some bugs in this release.
New features
- Supporting AddAPPStartHook function
- Supporting plugin mode; Supporting AddGroupRouter for configuring plugin routes.
- Response supporting HiJacker interface
- AddFilter supports batch matching
- Refactored session module, supporting Cookie engine
- Performance benchmark for ORM
- Added strings interface for config which allows configuration
- Supporting template render control in controller level
- Added basicauth plugin which can implement authentication easily
- #436 insert multiple objects
- #384 query map to struct
bugfix
- Fixed the bug of FileCache
- Fixed the import lib of websocket
- Changed http status from 200 to 500 when there are internal error.
- gmfim map in memzipfile.go file should use some synchronization mechanism (for example sync.RWMutex) otherwise it errors sometimes.
- Fixed #440 on_delete bug that not getting delted automatically
- Fixed #441 timezone bug
released date: 2014-02-10
Beego 1.0 release
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:
-
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.
-
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.
-
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.
-
Redesigned Beego website. Nice people from Beego community helped Beego for logo design and website design.
-
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.
-
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.
-
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
-
Powerful assistance tools. bee is used to assist the development of Beego applications. It can create, compile, package the Beego application easily.
released date: 2013-12-19