fix some comments (#5194)

Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
cui fliter 2023-05-21 13:48:06 +08:00 committed by Ming Deng
parent 4e481606f7
commit 2c62865a35
5 changed files with 136 additions and 114 deletions

View File

@ -185,7 +185,7 @@ When you try to use SSDB cache, it failed. There are many cases:
`)
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.
`)

View File

@ -122,7 +122,7 @@ func (fc *FileCache) Init() error {
return nil
}
// getCachedFilename returns an md5 encoded file name.
// getCacheFileName returns a md5 encoded file name.
func (fc *FileCache) getCacheFileName(key string) (string, error) {
m := md5.New()
_, _ = io.WriteString(m, key)

View File

@ -2277,7 +2277,7 @@ func TestTxOrmRollbackUnlessCommit(t *testing.T) {
o := NewOrm()
var tag Tag
// test not commited and call RollbackUnlessCommit
// test not committed and call RollbackUnlessCommit
to, err := o.Begin()
assert.Nil(t, err)
tag.Name = "rollback unless commit"

View File

@ -317,6 +317,7 @@ func RouterWithOpts(rootpath string, c ControllerInterface, opts ...ControllerOp
// Router adds a patterned controller handler to BeeApp.
// it's an alias method of HttpServer.Router.
// usage:
//
// simple router
// beego.Router("/admin", &admin.UserController{})
// 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.
//
// Usage (replace "GET" with "*" for all methods):
//
// beego.UnregisterFixedRoute("/yourpreviouspath", "GET")
// beego.Router("/yourpreviouspath", yourControllerAddress, "get:GetNewPage")
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
// usage:
// beego.Include(&BankAccount{}, &OrderController{},&RefundController{},&ReceiptController{})
//
// type BankAccount struct{
// beego.Controller
// }
//
// register the function
//
// func (b *BankAccount)Mapping(){
// b.Mapping("ShowAccount" , b.ShowAccount)
// b.Mapping("ModifyAccount", b.ModifyAccount)
// }
//
// //@router /account/:id [get]
//
// func (b *BankAccount) ShowAccount(){
// //logic
// }
//
//
// //@router /account/:id [post]
//
// func (b *BankAccount) ModifyAccount(){
// //logic
// }
@ -508,6 +513,7 @@ func CtrlGet(rootpath string, f interface{}) {
// CtrlGet used to register router for CtrlGet method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -528,6 +534,7 @@ func CtrlPost(rootpath string, f interface{}) {
// CtrlPost used to register router for CtrlPost method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -548,6 +555,7 @@ func CtrlHead(rootpath string, f interface{}) {
// CtrlHead used to register router for CtrlHead method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -568,6 +576,7 @@ func CtrlPut(rootpath string, f interface{}) {
// CtrlPut used to register router for CtrlPut method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -588,6 +597,7 @@ func CtrlPatch(rootpath string, f interface{}) {
// CtrlPatch used to register router for CtrlPatch method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -608,6 +618,7 @@ func CtrlDelete(rootpath string, f interface{}) {
// CtrlDelete used to register router for CtrlDelete method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -628,6 +639,7 @@ func CtrlOptions(rootpath string, f interface{}) {
// CtrlOptions used to register router for CtrlOptions method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -648,6 +660,7 @@ func CtrlAny(rootpath string, f interface{}) {
// CtrlAny used to register router for CtrlAny method
// usage:
//
// type MyController struct {
// web.Controller
// }
@ -668,6 +681,7 @@ func Get(rootpath string, f HandleFunc) *HttpServer {
// Get used to register router for Get method
// usage:
//
// beego.Get("/", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -683,6 +697,7 @@ func Post(rootpath string, f HandleFunc) *HttpServer {
// Post used to register router for Post method
// usage:
//
// beego.Post("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -698,6 +713,7 @@ func Delete(rootpath string, f HandleFunc) *HttpServer {
// Delete used to register router for Delete method
// usage:
//
// beego.Delete("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -713,6 +729,7 @@ func Put(rootpath string, f HandleFunc) *HttpServer {
// Put used to register router for Put method
// usage:
//
// beego.Put("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -728,6 +745,7 @@ func Head(rootpath string, f HandleFunc) *HttpServer {
// Head used to register router for Head method
// usage:
//
// beego.Head("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -744,6 +762,7 @@ func Options(rootpath string, f HandleFunc) *HttpServer {
// Options used to register router for Options method
// usage:
//
// beego.Options("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -759,6 +778,7 @@ func Patch(rootpath string, f HandleFunc) *HttpServer {
// Patch used to register router for Patch method
// usage:
//
// beego.Patch("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
// })
@ -774,6 +794,7 @@ func Any(rootpath string, f HandleFunc) *HttpServer {
// Any used to register router for all methods
// usage:
//
// beego.Any("/api", func(ctx *context.Context){
// 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
// usage:
//
// beego.Handler("/api", http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
// 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
}
// InserFilter see HttpServer.InsertFilter
// InsertFilter see HttpServer.InsertFilter
func InsertFilter(pattern string, pos int, filter FilterFunc, opts ...FilterOpt) *HttpServer {
return BeeApp.InsertFilter(pattern, pos, filter, opts...)
}

View File

@ -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 {
return func(config *ManagerConfig) {
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 {
return func(config *ManagerConfig) {
config.CookieLifeTime = lifeTime