parent
4e481606f7
commit
2c62865a35
2
client/cache/error_code.go
vendored
2
client/cache/error_code.go
vendored
@ -185,7 +185,7 @@ When you try to use SSDB cache, it failed. There are many cases:
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
var SsdbBadResponse = berror.DefineCode(5002007, moduleName, "SsdbBadResponse", `
|
var SsdbBadResponse = berror.DefineCode(5002007, moduleName, "SsdbBadResponse", `
|
||||||
The reponse from SSDB server is invalid.
|
The response from SSDB server is invalid.
|
||||||
Usually it indicates something wrong on server side.
|
Usually it indicates something wrong on server side.
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
|||||||
2
client/cache/file.go
vendored
2
client/cache/file.go
vendored
@ -122,7 +122,7 @@ func (fc *FileCache) Init() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getCachedFilename returns an md5 encoded file name.
|
// getCacheFileName returns a md5 encoded file name.
|
||||||
func (fc *FileCache) getCacheFileName(key string) (string, error) {
|
func (fc *FileCache) getCacheFileName(key string) (string, error) {
|
||||||
m := md5.New()
|
m := md5.New()
|
||||||
_, _ = io.WriteString(m, key)
|
_, _ = io.WriteString(m, key)
|
||||||
|
|||||||
@ -2277,7 +2277,7 @@ func TestTxOrmRollbackUnlessCommit(t *testing.T) {
|
|||||||
o := NewOrm()
|
o := NewOrm()
|
||||||
var tag Tag
|
var tag Tag
|
||||||
|
|
||||||
// test not commited and call RollbackUnlessCommit
|
// test not committed and call RollbackUnlessCommit
|
||||||
to, err := o.Begin()
|
to, err := o.Begin()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
tag.Name = "rollback unless commit"
|
tag.Name = "rollback unless commit"
|
||||||
|
|||||||
@ -317,6 +317,7 @@ func RouterWithOpts(rootpath string, c ControllerInterface, opts ...ControllerOp
|
|||||||
// Router adds a patterned controller handler to BeeApp.
|
// Router adds a patterned controller handler to BeeApp.
|
||||||
// it's an alias method of HttpServer.Router.
|
// it's an alias method of HttpServer.Router.
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// simple router
|
// simple router
|
||||||
// beego.Router("/admin", &admin.UserController{})
|
// beego.Router("/admin", &admin.UserController{})
|
||||||
// beego.Router("/admin/index", &admin.ArticleController{})
|
// beego.Router("/admin/index", &admin.ArticleController{})
|
||||||
@ -351,6 +352,7 @@ func UnregisterFixedRoute(fixedRoute string, method string) *HttpServer {
|
|||||||
// method type (e.g. "GET" or "POST") for selective removal.
|
// method type (e.g. "GET" or "POST") for selective removal.
|
||||||
//
|
//
|
||||||
// Usage (replace "GET" with "*" for all methods):
|
// Usage (replace "GET" with "*" for all methods):
|
||||||
|
//
|
||||||
// beego.UnregisterFixedRoute("/yourpreviouspath", "GET")
|
// beego.UnregisterFixedRoute("/yourpreviouspath", "GET")
|
||||||
// beego.Router("/yourpreviouspath", yourControllerAddress, "get:GetNewPage")
|
// beego.Router("/yourpreviouspath", yourControllerAddress, "get:GetNewPage")
|
||||||
func (app *HttpServer) UnregisterFixedRoute(fixedRoute string, method string) *HttpServer {
|
func (app *HttpServer) UnregisterFixedRoute(fixedRoute string, method string) *HttpServer {
|
||||||
@ -430,23 +432,26 @@ func Include(cList ...ControllerInterface) *HttpServer {
|
|||||||
// Include will generate router file in the router/xxx.go from the controller's comments
|
// Include will generate router file in the router/xxx.go from the controller's comments
|
||||||
// usage:
|
// usage:
|
||||||
// beego.Include(&BankAccount{}, &OrderController{},&RefundController{},&ReceiptController{})
|
// beego.Include(&BankAccount{}, &OrderController{},&RefundController{},&ReceiptController{})
|
||||||
|
//
|
||||||
// type BankAccount struct{
|
// type BankAccount struct{
|
||||||
// beego.Controller
|
// beego.Controller
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// register the function
|
// register the function
|
||||||
|
//
|
||||||
// func (b *BankAccount)Mapping(){
|
// func (b *BankAccount)Mapping(){
|
||||||
// b.Mapping("ShowAccount" , b.ShowAccount)
|
// b.Mapping("ShowAccount" , b.ShowAccount)
|
||||||
// b.Mapping("ModifyAccount", b.ModifyAccount)
|
// b.Mapping("ModifyAccount", b.ModifyAccount)
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// //@router /account/:id [get]
|
// //@router /account/:id [get]
|
||||||
|
//
|
||||||
// func (b *BankAccount) ShowAccount(){
|
// func (b *BankAccount) ShowAccount(){
|
||||||
// //logic
|
// //logic
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// //@router /account/:id [post]
|
// //@router /account/:id [post]
|
||||||
|
//
|
||||||
// func (b *BankAccount) ModifyAccount(){
|
// func (b *BankAccount) ModifyAccount(){
|
||||||
// //logic
|
// //logic
|
||||||
// }
|
// }
|
||||||
@ -508,6 +513,7 @@ func CtrlGet(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlGet used to register router for CtrlGet method
|
// CtrlGet used to register router for CtrlGet method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -528,6 +534,7 @@ func CtrlPost(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlPost used to register router for CtrlPost method
|
// CtrlPost used to register router for CtrlPost method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -548,6 +555,7 @@ func CtrlHead(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlHead used to register router for CtrlHead method
|
// CtrlHead used to register router for CtrlHead method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -568,6 +576,7 @@ func CtrlPut(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlPut used to register router for CtrlPut method
|
// CtrlPut used to register router for CtrlPut method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -588,6 +597,7 @@ func CtrlPatch(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlPatch used to register router for CtrlPatch method
|
// CtrlPatch used to register router for CtrlPatch method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -608,6 +618,7 @@ func CtrlDelete(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlDelete used to register router for CtrlDelete method
|
// CtrlDelete used to register router for CtrlDelete method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -628,6 +639,7 @@ func CtrlOptions(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlOptions used to register router for CtrlOptions method
|
// CtrlOptions used to register router for CtrlOptions method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -648,6 +660,7 @@ func CtrlAny(rootpath string, f interface{}) {
|
|||||||
|
|
||||||
// CtrlAny used to register router for CtrlAny method
|
// CtrlAny used to register router for CtrlAny method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// type MyController struct {
|
// type MyController struct {
|
||||||
// web.Controller
|
// web.Controller
|
||||||
// }
|
// }
|
||||||
@ -668,6 +681,7 @@ func Get(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Get used to register router for Get method
|
// Get used to register router for Get method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Get("/", func(ctx *context.Context){
|
// beego.Get("/", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -683,6 +697,7 @@ func Post(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Post used to register router for Post method
|
// Post used to register router for Post method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Post("/api", func(ctx *context.Context){
|
// beego.Post("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -698,6 +713,7 @@ func Delete(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Delete used to register router for Delete method
|
// Delete used to register router for Delete method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Delete("/api", func(ctx *context.Context){
|
// beego.Delete("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -713,6 +729,7 @@ func Put(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Put used to register router for Put method
|
// Put used to register router for Put method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Put("/api", func(ctx *context.Context){
|
// beego.Put("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -728,6 +745,7 @@ func Head(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Head used to register router for Head method
|
// Head used to register router for Head method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Head("/api", func(ctx *context.Context){
|
// beego.Head("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -744,6 +762,7 @@ func Options(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Options used to register router for Options method
|
// Options used to register router for Options method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Options("/api", func(ctx *context.Context){
|
// beego.Options("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -759,6 +778,7 @@ func Patch(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Patch used to register router for Patch method
|
// Patch used to register router for Patch method
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Patch("/api", func(ctx *context.Context){
|
// beego.Patch("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -774,6 +794,7 @@ func Any(rootpath string, f HandleFunc) *HttpServer {
|
|||||||
|
|
||||||
// Any used to register router for all methods
|
// Any used to register router for all methods
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Any("/api", func(ctx *context.Context){
|
// beego.Any("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
@ -789,6 +810,7 @@ func Handler(rootpath string, h http.Handler, options ...interface{}) *HttpServe
|
|||||||
|
|
||||||
// Handler used to register a Handler router
|
// Handler used to register a Handler router
|
||||||
// usage:
|
// usage:
|
||||||
|
//
|
||||||
// beego.Handler("/api", http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
|
// beego.Handler("/api", http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
|
||||||
// fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
|
// fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
|
||||||
// }))
|
// }))
|
||||||
@ -797,7 +819,7 @@ func (app *HttpServer) Handler(rootpath string, h http.Handler, options ...inter
|
|||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// InserFilter see HttpServer.InsertFilter
|
// InsertFilter see HttpServer.InsertFilter
|
||||||
func InsertFilter(pattern string, pos int, filter FilterFunc, opts ...FilterOpt) *HttpServer {
|
func InsertFilter(pattern string, pos int, filter FilterFunc, opts ...FilterOpt) *HttpServer {
|
||||||
return BeeApp.InsertFilter(pattern, pos, filter, opts...)
|
return BeeApp.InsertFilter(pattern, pos, filter, opts...)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ func CfgCookieName(cookieName string) ManagerConfigOpt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CfgCookieName set len of session id
|
// CfgSessionIdLength set len of session id
|
||||||
func CfgSessionIdLength(length int64) ManagerConfigOpt {
|
func CfgSessionIdLength(length int64) ManagerConfigOpt {
|
||||||
return func(config *ManagerConfig) {
|
return func(config *ManagerConfig) {
|
||||||
config.SessionIDLength = length
|
config.SessionIDLength = length
|
||||||
@ -79,7 +79,7 @@ func CfgMaxLifeTime(lifeTime int64) ManagerConfigOpt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CfgGcLifeTime set session lift time
|
// CfgCookieLifeTime set cookie lift time
|
||||||
func CfgCookieLifeTime(lifeTime int) ManagerConfigOpt {
|
func CfgCookieLifeTime(lifeTime int) ManagerConfigOpt {
|
||||||
return func(config *ManagerConfig) {
|
return func(config *ManagerConfig) {
|
||||||
config.CookieLifeTime = lifeTime
|
config.CookieLifeTime = lifeTime
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user