Directories ¶
Path | Synopsis |
---|---|
Package admin healthcheck type DatabaseCheck struct { } func (dc *DatabaseCheck) Check() error { if dc.isConnected() { return nil } else { return errors.New("can't connect database") } } AddHealthCheck("database",&DatabaseCheck{}) more docs: http://beego.me/docs/module/toolbox.md
|
Package admin healthcheck type DatabaseCheck struct { } func (dc *DatabaseCheck) Check() error { if dc.isConnected() { return nil } else { return errors.New("can't connect database") } } AddHealthCheck("database",&DatabaseCheck{}) more docs: http://beego.me/docs/module/toolbox.md |
bean is a basic package it should not depend on other modules except common module, log module and config module
|
bean is a basic package it should not depend on other modules except common module, log module and config module |
Package config is used to parse config.
|
Package config is used to parse config. |
env
Package env is used to parse environment.
|
Package env is used to parse environment. |
xml
Package xml for config provider.
|
Package xml for config provider. |
yaml
Package yaml for config provider depend on github.com/beego/goyaml2 go install github.com/beego/goyaml2 Usage: import( _ "github.com/beego/beego/v2/core/config/yaml" "github.com/beego/beego/v2/core/config" ) cnf, err := config.NewConfig("yaml", "config.yaml") More docs http://beego.me/docs/module/config.md
|
Package yaml for config provider depend on github.com/beego/goyaml2 go install github.com/beego/goyaml2 Usage: import( _ "github.com/beego/beego/v2/core/config/yaml" "github.com/beego/beego/v2/core/config" ) cnf, err := config.NewConfig("yaml", "config.yaml") More docs http://beego.me/docs/module/config.md |
Package logs provide a general log interface Usage: import "github.com/beego/beego/v2/core/logs" log := NewLogger(10000) log.SetLogger("console", "") > the first params stand for how many channel Use it like this: log.Trace("trace") log.Info("info") log.Warn("warning") log.Debug("debug") log.Critical("critical") more docs http://beego.me/docs/module/logs.md
|
Package logs provide a general log interface Usage: import "github.com/beego/beego/v2/core/logs" log := NewLogger(10000) log.SetLogger("console", "") > the first params stand for how many channel Use it like this: log.Trace("trace") log.Info("info") log.Warn("warning") log.Debug("debug") log.Critical("critical") more docs http://beego.me/docs/module/logs.md |
alils
Package alils implements the SDK(v0.5.0) of Simple Log Service(abbr.
|
Package alils implements the SDK(v0.5.0) of Simple Log Service(abbr. |
pagination
Package pagination provides utilities to setup a paginator within the context of a http request.
|
Package pagination provides utilities to setup a paginator within the context of a http request. |
Package validation for validations import ( "github.com/beego/beego/v2/core/validation" "log" ) type User struct { Name string Age int } func main() { u := User{"man", 40} valid := validation.Validation{} valid.Required(u.Name, "name") valid.MaxSize(u.Name, 15, "nameMax") valid.Range(u.Age, 0, 140, "age") if valid.HasErrors() { // validation does not pass // print invalid message for _, err := range valid.Errors { log.Println(err.Key, err.Message) } } // or use like this if v := valid.Max(u.Age, 140, "ageMax"); !v.Ok { log.Println(v.Error.Key, v.Error.Message) } } more info: http://beego.me/docs/mvc/controller/validation.md
|
Package validation for validations import ( "github.com/beego/beego/v2/core/validation" "log" ) type User struct { Name string Age int } func main() { u := User{"man", 40} valid := validation.Validation{} valid.Required(u.Name, "name") valid.MaxSize(u.Name, 15, "nameMax") valid.Range(u.Age, 0, 140, "age") if valid.HasErrors() { // validation does not pass // print invalid message for _, err := range valid.Errors { log.Println(err.Key, err.Message) } } // or use like this if v := valid.Max(u.Age, 140, "ageMax"); !v.Ok { log.Println(v.Error.Key, v.Error.Message) } } more info: http://beego.me/docs/mvc/controller/validation.md |
Click to show internal directories.
Click to hide internal directories.