Documentation ¶
There is no documentation for this package.
Directories ¶
Path | Synopsis |
---|---|
algorithm
|
|
validation
Package validation for validations import ( "github.com/astaxie/beego/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/astaxie/beego/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 |
encryption
|
|
example
|
|
Package httplib is used as http.Client Usage: import "github.com/astaxie/beego/httplib" b := httplib.Post("http://beego.me/") 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) } fmt.Println(str) more docs http://beego.me/docs/module/httplib.md
|
Package httplib is used as http.Client Usage: import "github.com/astaxie/beego/httplib" b := httplib.Post("http://beego.me/") 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) } fmt.Println(str) more docs http://beego.me/docs/module/httplib.md |
Solr client in Go, core admin, add docs, update, delete, search and more package main import ( "github.com/vanng822/go-solr/solr" "fmt" ) func main() { si, _ := solr.NewSolrInterface("http://localhost:8983/solr", "collection1") query := solr.NewQuery() query.Q("*:*") s := si.Search(query) r, _ := s.Result(nil) fmt.Println(r.Results.Docs) }
|
Solr client in Go, core admin, add docs, update, delete, search and more package main import ( "github.com/vanng822/go-solr/solr" "fmt" ) func main() { si, _ := solr.NewSolrInterface("http://localhost:8983/solr", "collection1") query := solr.NewQuery() query.Q("*:*") s := si.Search(query) r, _ := s.Result(nil) fmt.Println(r.Results.Docs) } |
Click to show internal directories.
Click to hide internal directories.