Merge pull request #4823 from flycash/develop

replace beego.me with beego.vip
This commit is contained in:
Ming Deng 2021-11-29 21:39:35 +08:00 committed by GitHub
commit 3dd5a1adfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 79 additions and 79 deletions

View File

@ -86,4 +86,4 @@ Please take a moment to check that an issue doesn't already exist documenting yo
If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common
problems and requests.
Also, if you don't know how to use it. please make sure you have read through the docs in http://beego.me/docs
Also, if you don't know how to use it. please make sure you have read through the docs in http://beego.vip/docs

View File

@ -28,7 +28,7 @@
// bm.IsExist("astaxie")
// bm.Delete("astaxie")
//
// more docs http://beego.me/docs/module/cache.md
// more docs http://beego.vip/docs/module/cache.md
package cache
import (

View File

@ -26,7 +26,7 @@
//
// bm, err := cache.NewCache("memcache", `{"conn":"127.0.0.1:11211"}`)
//
// more docs http://beego.me/docs/module/cache.md
// more docs http://beego.vip/docs/module/cache.md
package memcache
import (

View File

@ -26,7 +26,7 @@
//
// bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`)
//
// more docs http://beego.me/docs/module/cache.md
// more docs http://beego.vip/docs/module/cache.md
package redis
import (

View File

@ -37,7 +37,7 @@
// cnf.DIY(key string) (interface{}, error)
// cnf.GetSection(section string) (map[string]string, error)
// cnf.SaveConfigFile(filename string) error
// More docs http://beego.me/docs/module/config.md
// More docs http://beego.vip/docs/module/config.md
package config
import (

View File

@ -26,7 +26,7 @@
//
// cnf, err := config.NewConfig("xml", "config.xml")
//
// More docs http://beego.me/docs/module/config.md
// More docs http://beego.vip/docs/module/config.md
package xml
import (

View File

@ -26,7 +26,7 @@
//
// cnf, err := config.NewConfig("yaml", "config.yaml")
//
// More docs http://beego.me/docs/module/config.md
// More docs http://beego.vip/docs/module/config.md
package yaml
import (

View File

@ -19,7 +19,7 @@
//
// ctx := context.Context{Request:req,ResponseWriter:rw}
//
// more docs http://beego.me/docs/module/context.md
// more docs http://beego.vip/docs/module/context.md
package context
import (

View File

@ -17,7 +17,7 @@
//
// import "github.com/beego/beego/v2/client/httplib"
//
// b := httplib.Post("http://beego.me/")
// b := httplib.Post("http://beego.vip/")
// b.Param("username","astaxie")
// b.Param("password","123456")
// b.PostFile("uploadfile1", "httplib.pdf")
@ -28,7 +28,7 @@
// }
// fmt.Println(str)
//
// more docs http://beego.me/docs/module/httplib.md
// more docs http://beego.vip/docs/module/httplib.md
package httplib
import (

View File

@ -30,7 +30,7 @@
// log.Debug("debug")
// log.Critical("critical")
//
// more docs http://beego.me/docs/module/logs.md
// more docs http://beego.vip/docs/module/logs.md
package logs
import (

View File

@ -51,7 +51,7 @@ func oldToNewLinkNs(params []LinkNamespace) []web.LinkNamespace {
// if cond return true can run this namespace, else can't
// usage:
// ns.Cond(func (ctx *context.Context) bool{
// if ctx.Input.Domain() == "api.beego.me" {
// if ctx.Input.Domain() == "api.beego.vip" {
// return true
// }
// return false

View File

@ -50,7 +50,7 @@
// num, err = o.Delete(&u)
// }
//
// more docs: http://beego.me/docs/mvc/model/overview.md
// more docs: http://beego.vip/docs/mvc/model/overview.md
package orm
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package couchbase
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package memcache
import (

View File

@ -37,7 +37,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package mysql
import (

View File

@ -47,7 +47,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package postgres
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package redis
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package redis_cluster
import (

View File

@ -24,7 +24,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package session
import (

View File

@ -106,7 +106,7 @@ func Htmlunquote(text string) string {
// /login?next=/
// /user/John%20Doe
//
// more detail http://beego.me/docs/mvc/controller/urlbuilding.md
// more detail http://beego.vip/docs/mvc/controller/urlbuilding.md
func URLFor(endpoint string, values ...interface{}) string {
return web.URLFor(endpoint, values...)
}

View File

@ -27,7 +27,7 @@
//
// AddHealthCheck("database",&DatabaseCheck{})
//
// more docs: http://beego.me/docs/module/toolbox.md
// more docs: http://beego.vip/docs/module/toolbox.md
package toolbox
import (

View File

@ -52,7 +52,7 @@ In your view templates:
See also
http://beego.me/docs/mvc/view/page.md
http://beego.vip/docs/mvc/view/page.md
*/
package pagination

View File

@ -43,7 +43,7 @@
// }
// }
//
// more info: http://beego.me/docs/mvc/controller/validation.md
// more info: http://beego.vip/docs/mvc/controller/validation.md
package validation
import (

View File

@ -28,7 +28,7 @@
// bm.IsExist("astaxie")
// bm.Delete("astaxie")
//
// more docs http://beego.me/docs/module/cache.md
// more docs http://beego.vip/docs/module/cache.md
package cache
import (

View File

@ -26,7 +26,7 @@
//
// bm, err := cache.NewCache("memcache", `{"conn":"127.0.0.1:11211"}`)
//
// more docs http://beego.me/docs/module/cache.md
// more docs http://beego.vip/docs/module/cache.md
package memcache
import (

View File

@ -26,7 +26,7 @@
//
// bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`)
//
// more docs http://beego.me/docs/module/cache.md
// more docs http://beego.vip/docs/module/cache.md
package redis
import (

View File

@ -10,7 +10,7 @@ you can use Get to crawl data.
import "github.com/beego/beego/v2/client/httplib"
str, err := httplib.Get("http://beego.me/").String()
str, err := httplib.Get("http://beego.vip/").String()
if err != nil {
// error
}
@ -20,7 +20,7 @@ you can use Get to crawl data.
POST data to remote url
req := httplib.Post("http://beego.me/")
req := httplib.Post("http://beego.vip/")
req.Param("username","astaxie")
req.Param("password","123456")
str, err := req.String()
@ -38,20 +38,20 @@ The default timeout is `60` seconds, function prototype:
Example:
// GET
httplib.Get("http://beego.me/").SetTimeout(100 * time.Second, 30 * time.Second)
httplib.Get("http://beego.vip/").SetTimeout(100 * time.Second, 30 * time.Second)
// POST
httplib.Post("http://beego.me/").SetTimeout(100 * time.Second, 30 * time.Second)
httplib.Post("http://beego.vip/").SetTimeout(100 * time.Second, 30 * time.Second)
## Debug
If you want to debug the request info, set the debug on
httplib.Get("http://beego.me/").Debug(true)
httplib.Get("http://beego.vip/").Debug(true)
## Set HTTP Basic Auth
str, err := Get("http://beego.me/").SetBasicAuth("user", "passwd").String()
str, err := Get("http://beego.vip/").SetBasicAuth("user", "passwd").String()
if err != nil {
// error
}
@ -69,7 +69,7 @@ More info about the `tls.Config` please visit http://golang.org/pkg/crypto/tls/#
some servers need to specify the protocol version of HTTP
httplib.Get("http://beego.me/").SetProtocolVersion("HTTP/1.1")
httplib.Get("http://beego.vip/").SetProtocolVersion("HTTP/1.1")
## Set Cookie
@ -78,13 +78,13 @@ some http request need setcookie. So set it like this:
cookie := &http.Cookie{}
cookie.Name = "username"
cookie.Value = "astaxie"
httplib.Get("http://beego.me/").SetCookie(cookie)
httplib.Get("http://beego.vip/").SetCookie(cookie)
## Upload file
httplib support mutil file upload, use `req.PostFile()`
req := httplib.Post("http://beego.me/")
req := httplib.Post("http://beego.vip/")
req.Param("username","astaxie")
req.PostFile("uploadfile1", "httplib.pdf")
str, err := req.String()

View File

@ -25,7 +25,7 @@ import (
)
func TestNewClient(t *testing.T) {
client, err := NewClient("test1", "http://beego.me", WithEnableCookie(true))
client, err := NewClient("test1", "http://beego.vip", WithEnableCookie(true))
assert.NoError(t, err)
assert.NotNil(t, client)
assert.Equal(t, true, client.Setting.EnableCookie)
@ -204,7 +204,7 @@ func TestClientDelete(t *testing.T) {
}
func TestClientHead(t *testing.T) {
client, err := NewClient("test", "http://beego.me")
client, err := NewClient("test", "http://beego.vip")
if err != nil {
t.Fatal(err)
}

View File

@ -17,7 +17,7 @@
//
// import "github.com/beego/beego/v2/client/httplib"
//
// b := httplib.Post("http://beego.me/")
// b := httplib.Post("http://beego.vip/")
// b.Param("username","astaxie")
// b.Param("password","123456")
// b.PostFile("uploadfile1", "httplib.pdf")
@ -28,7 +28,7 @@
// }
// fmt.Println(str)
//
// more docs http://beego.me/docs/module/httplib.md
// more docs http://beego.vip/docs/module/httplib.md
package httplib
import (

View File

@ -290,19 +290,19 @@ func TestHeader(t *testing.T) {
// TestAddFilter make sure that AddFilters only work for the specific request
func TestAddFilter(t *testing.T) {
req := Get("http://beego.me")
req := Get("http://beego.vip")
req.AddFilters(func(next Filter) Filter {
return func(ctx context.Context, req *BeegoHTTPRequest) (*http.Response, error) {
return next(ctx, req)
}
})
r := Get("http://beego.me")
r := Get("http://beego.vip")
assert.Equal(t, 1, len(req.setting.FilterChains)-len(r.setting.FilterChains))
}
func TestFilterChainOrder(t *testing.T) {
req := Get("http://beego.me")
req := Get("http://beego.vip")
req.AddFilters(func(next Filter) Filter {
return func(ctx context.Context, req *BeegoHTTPRequest) (*http.Response, error) {
return NewHttpResponseWithJsonBody("first"), nil
@ -323,35 +323,35 @@ func TestFilterChainOrder(t *testing.T) {
}
func TestHead(t *testing.T) {
req := Head("http://beego.me")
req := Head("http://beego.vip")
assert.NotNil(t, req)
assert.Equal(t, "HEAD", req.req.Method)
}
func TestDelete(t *testing.T) {
req := Delete("http://beego.me")
req := Delete("http://beego.vip")
assert.NotNil(t, req)
assert.Equal(t, "DELETE", req.req.Method)
}
func TestPost(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
assert.NotNil(t, req)
assert.Equal(t, "POST", req.req.Method)
}
func TestNewBeegoRequest(t *testing.T) {
req := NewBeegoRequest("http://beego.me", "GET")
req := NewBeegoRequest("http://beego.vip", "GET")
assert.NotNil(t, req)
assert.Equal(t, "GET", req.req.Method)
// invalid case but still go request
req = NewBeegoRequest("httpa\ta://beego.me", "GET")
req = NewBeegoRequest("httpa\ta://beego.vip", "GET")
assert.NotNil(t, req)
}
func TestBeegoHTTPRequestSetProtocolVersion(t *testing.T) {
req := NewBeegoRequest("http://beego.me", "GET")
req := NewBeegoRequest("http://beego.vip", "GET")
req.SetProtocolVersion("HTTP/3.10")
assert.Equal(t, "HTTP/3.10", req.req.Proto)
assert.Equal(t, 3, req.req.ProtoMajor)
@ -370,27 +370,27 @@ func TestBeegoHTTPRequestSetProtocolVersion(t *testing.T) {
}
func TestPut(t *testing.T) {
req := Put("http://beego.me")
req := Put("http://beego.vip")
assert.NotNil(t, req)
assert.Equal(t, "PUT", req.req.Method)
}
func TestBeegoHTTPRequestHeader(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
key, value := "test-header", "test-header-value"
req.Header(key, value)
assert.Equal(t, value, req.req.Header.Get(key))
}
func TestBeegoHTTPRequestSetHost(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
host := "test-hose"
req.SetHost(host)
assert.Equal(t, host, req.req.Host)
}
func TestBeegoHTTPRequestParam(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
key, value := "test-param", "test-param-value"
req.Param(key, value)
assert.Equal(t, value, req.params[key][0])
@ -401,7 +401,7 @@ func TestBeegoHTTPRequestParam(t *testing.T) {
}
func TestBeegoHTTPRequestBody(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
body := `hello, world`
req.Body([]byte(body))
assert.Equal(t, int64(len(body)), req.req.ContentLength)
@ -423,7 +423,7 @@ type user struct {
}
func TestBeegoHTTPRequestXMLBody(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
body := &user{
Name: "Tom",
}
@ -438,7 +438,7 @@ func TestBeegoHTTPRequestResponseForValue(t *testing.T) {
}
func TestBeegoHTTPRequestJSONMarshal(t *testing.T) {
req := Post("http://beego.me")
req := Post("http://beego.vip")
req.SetEscapeHTML(false)
body := map[string]interface{}{
"escape": "left&right",

View File

@ -155,5 +155,5 @@ note: not recommend use this in product env.
more details and examples in docs and test
[documents](http://beego.me/docs/mvc/model/overview.md)
[documents](http://beego.vip/docs/mvc/model/overview.md)

View File

@ -50,7 +50,7 @@
// num, err = o.Delete(&u)
// }
//
// more docs: http://beego.me/docs/mvc/model/overview.md
// more docs: http://beego.vip/docs/mvc/model/overview.md
package orm
import (

View File

@ -27,7 +27,7 @@
//
// AddHealthCheck("database",&DatabaseCheck{})
//
// more docs: http://beego.me/docs/module/toolbox.md
// more docs: http://beego.vip/docs/module/toolbox.md
package admin
// AdminCheckList holds health checker map

View File

@ -37,7 +37,7 @@
// cnf.DIY(key string) (interface{}, error)
// cnf.GetSection(section string) (map[string]string, error)
// cnf.SaveConfigFile(filename string) error
// More docs http://beego.me/docs/module/config.md
// More docs http://beego.vip/docs/module/config.md
package config
import (

View File

@ -26,7 +26,7 @@
//
// cnf, err := config.NewConfig("xml", "config.xml")
//
// More docs http://beego.me/docs/module/config.md
// More docs http://beego.vip/docs/module/config.md
package xml
import (

View File

@ -21,7 +21,7 @@
//
// cnf, err := config.NewConfig("yaml", "config.yaml")
//
// More docs http://beego.me/docs/module/config.md
// More docs http://beego.vip/docs/module/config.md
package yaml
import (

View File

@ -30,7 +30,7 @@
// log.Debug("debug")
// log.Critical("critical")
//
// more docs http://beego.me/docs/module/logs.md
// more docs http://beego.vip/docs/module/logs.md
package logs
import (

View File

@ -52,7 +52,7 @@ In your view templates:
See also
http://beego.me/docs/mvc/view/page.md
http://beego.vip/docs/mvc/view/page.md
*/
package pagination

View File

@ -43,7 +43,7 @@
// }
// }
//
// more info: http://beego.me/docs/mvc/controller/validation.md
// more info: http://beego.vip/docs/mvc/controller/validation.md
package validation
import (

View File

@ -21,10 +21,10 @@ var indexTpl = `
For detail usage please check our document:
</p>
<p>
<a target="_blank" href="http://beego.me/docs/module/admin.md">Toolbox</a>
<a target="_blank" href="http://beego.vip/docs/module/admin.md">Toolbox</a>
</p>
<p>
<a target="_blank" href="http://beego.me/docs/advantage/monitor.md">Live Monitor</a>
<a target="_blank" href="http://beego.vip/docs/advantage/monitor.md">Live Monitor</a>
</p>
{{.Content}}
{{end}}`

View File

@ -19,7 +19,7 @@
//
// ctx := context.Context{Request:req,ResponseWriter:rw}
//
// more docs http://beego.me/docs/module/context.md
// more docs http://beego.vip/docs/module/context.md
package context
import (

View File

@ -12,6 +12,6 @@ beego is inspired by Tornado, Sinatra and Flask with the added benefit of some G
beego.Run()
}
more information: http://beego.me
more information: http://beego.vip
*/
package web

View File

@ -48,7 +48,7 @@ func NewNamespace(prefix string, params ...LinkNamespace) *Namespace {
// if cond return true can run this namespace, else can't
// usage:
// ns.Cond(func (ctx *context.Context) bool{
// if ctx.Input.Domain() == "api.beego.me" {
// if ctx.Input.Domain() == "api.beego.vip" {
// return true
// }
// return false

View File

@ -174,7 +174,7 @@ func TestNamespaceCond(t *testing.T) {
ns := NewNamespace("/v2")
ns.Cond(func(ctx *context.Context) bool {
return ctx.Input.Domain() == "beego.me"
return ctx.Input.Domain() == "beego.vip"
}).
AutoRouter(&TestController{})
AddNamespace(ns)

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package couchbase
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package memcache
import (

View File

@ -37,7 +37,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package mysql
import (

View File

@ -47,7 +47,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package postgres
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package redis
import (

View File

@ -29,7 +29,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package redis_cluster
import (

View File

@ -24,7 +24,7 @@
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
// more docs: http://beego.vip/docs/module/session.md
package session
import (

View File

@ -242,7 +242,7 @@ func Htmlunquote(text string) string {
// /login?next=/
// /user/John%20Doe
//
// more detail http://beego.me/docs/mvc/controller/urlbuilding.md
// more detail http://beego.vip/docs/mvc/controller/urlbuilding.md
func URLFor(endpoint string, values ...interface{}) string {
return BeeApp.Handlers.URLFor(endpoint, values...)
}