Merge pull request #4957 from beego/feature/v1.12.7
Align 1.12.7 to develop-1.x
This commit is contained in:
commit
5de3a5ac37
@ -9,7 +9,7 @@ services:
|
||||
- memcached
|
||||
env:
|
||||
global:
|
||||
- GO_REPO_FULLNAME="github.com/astaxie/beego"
|
||||
- GO_REPO_FULLNAME="github.com/beego/beego"
|
||||
matrix:
|
||||
- ORM_DRIVER=sqlite3 ORM_SOURCE=$TRAVIS_BUILD_DIR/orm_test.db
|
||||
- ORM_DRIVER=postgres ORM_SOURCE="user=postgres dbname=orm_test sslmode=disable"
|
||||
|
||||
@ -30,7 +30,7 @@ do it in other way.
|
||||
### Create issues
|
||||
|
||||
Any significant improvement should be documented as [a GitHub
|
||||
issue](https://github.com/astaxie/beego/issues) before anybody
|
||||
issue](https://github.com/beego/beego/issues) before anybody
|
||||
starts working on it.
|
||||
|
||||
Also when filing an issue, make sure to answer these five questions:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Beego [](https://travis-ci.org/astaxie/beego) [](http://godoc.org/github.com/astaxie/beego) [](http://golangfoundation.org) [](https://goreportcard.com/report/github.com/astaxie/beego)
|
||||
# Beego [](https://travis-ci.org/astaxie/beego) [](http://godoc.org/github.com/beego/beego) [](http://golangfoundation.org) [](https://goreportcard.com/report/github.com/beego/beego)
|
||||
|
||||
|
||||
beego is used for rapid development of RESTful APIs, web apps and backend services in Go.
|
||||
@ -19,13 +19,13 @@ It is inspired by Tornado, Sinatra and Flask. beego has some Go-specific feature
|
||||
|
||||
#### Download and install
|
||||
|
||||
go get github.com/astaxie/beego
|
||||
go get github.com/beego/beego
|
||||
|
||||
#### Create file `hello.go`
|
||||
```go
|
||||
package main
|
||||
|
||||
import "github.com/astaxie/beego"
|
||||
import "github.com/beego/beego"
|
||||
|
||||
func main(){
|
||||
beego.Run()
|
||||
|
||||
8
admin.go
8
admin.go
@ -27,10 +27,10 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
"github.com/astaxie/beego/grace"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/toolbox"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/grace"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/toolbox"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
// BeeAdminApp is the default adminApp used by admin module.
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/astaxie/beego/toolbox"
|
||||
"github.com/beego/beego/toolbox"
|
||||
)
|
||||
|
||||
type SampleDatabaseCheck struct {
|
||||
|
||||
6
app.go
6
app.go
@ -27,9 +27,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/grace"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/grace"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/utils"
|
||||
"golang.org/x/crypto/acme/autocert"
|
||||
)
|
||||
|
||||
|
||||
4
cache/README.md
vendored
4
cache/README.md
vendored
@ -4,7 +4,7 @@ cache is a Go cache manager. It can use many cache adapters. The repo is inspire
|
||||
|
||||
## How to install?
|
||||
|
||||
go get github.com/astaxie/beego/cache
|
||||
go get github.com/beego/beego/cache
|
||||
|
||||
|
||||
## What adapters are supported?
|
||||
@ -17,7 +17,7 @@ As of now this cache support memory, Memcache and Redis.
|
||||
First you must import it
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
)
|
||||
|
||||
Then init a Cache (example with memory adapter)
|
||||
|
||||
2
cache/cache.go
vendored
2
cache/cache.go
vendored
@ -16,7 +16,7 @@
|
||||
// Usage:
|
||||
//
|
||||
// import(
|
||||
// "github.com/astaxie/beego/cache"
|
||||
// "github.com/beego/beego/cache"
|
||||
// )
|
||||
//
|
||||
// bm, err := cache.NewCache("memory", `{"interval":60}`)
|
||||
|
||||
6
cache/memcache/memcache.go
vendored
6
cache/memcache/memcache.go
vendored
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/cache/memcache"
|
||||
// "github.com/astaxie/beego/cache"
|
||||
// _ "github.com/beego/beego/cache/memcache"
|
||||
// "github.com/beego/beego/cache"
|
||||
// )
|
||||
//
|
||||
// bm, err := cache.NewCache("memcache", `{"conn":"127.0.0.1:11211"}`)
|
||||
@ -35,7 +35,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
"github.com/bradfitz/gomemcache/memcache"
|
||||
)
|
||||
|
||||
|
||||
2
cache/memcache/memcache_test.go
vendored
2
cache/memcache/memcache_test.go
vendored
@ -21,7 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
)
|
||||
|
||||
func TestMemcacheCache(t *testing.T) {
|
||||
|
||||
6
cache/redis/redis.go
vendored
6
cache/redis/redis.go
vendored
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/cache/redis"
|
||||
// "github.com/astaxie/beego/cache"
|
||||
// _ "github.com/beego/beego/cache/redis"
|
||||
// "github.com/beego/beego/cache"
|
||||
// )
|
||||
//
|
||||
// bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`)
|
||||
@ -40,7 +40,7 @@ import (
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
2
cache/redis/redis_test.go
vendored
2
cache/redis/redis_test.go
vendored
@ -19,7 +19,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
|
||||
2
cache/ssdb/ssdb.go
vendored
2
cache/ssdb/ssdb.go
vendored
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/ssdb/gossdb/ssdb"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
)
|
||||
|
||||
// Cache SSDB adapter
|
||||
|
||||
2
cache/ssdb/ssdb_test.go
vendored
2
cache/ssdb/ssdb_test.go
vendored
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/beego/beego/cache"
|
||||
)
|
||||
|
||||
func TestSsdbcacheCache(t *testing.T) {
|
||||
|
||||
10
config.go
10
config.go
@ -24,11 +24,11 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/config"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/session"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
// Config is the main struct for BConfig
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
// Package config is used to parse config.
|
||||
// Usage:
|
||||
// import "github.com/astaxie/beego/config"
|
||||
// import "github.com/beego/beego/config"
|
||||
//Examples.
|
||||
//
|
||||
// cnf, err := config.NewConfig("ini", "config.conf")
|
||||
|
||||
2
config/env/env.go
vendored
2
config/env/env.go
vendored
@ -21,7 +21,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
var env *utils.BeeMap
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/config/xml"
|
||||
// "github.com/astaxie/beego/config"
|
||||
// _ "github.com/beego/beego/config/xml"
|
||||
// "github.com/beego/beego/config"
|
||||
// )
|
||||
//
|
||||
// cnf, err := config.NewConfig("xml", "config.xml")
|
||||
@ -39,7 +39,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/beego/beego/config"
|
||||
"github.com/beego/x2j"
|
||||
)
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/beego/beego/config"
|
||||
)
|
||||
|
||||
func TestXML(t *testing.T) {
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/config/yaml"
|
||||
// "github.com/astaxie/beego/config"
|
||||
// _ "github.com/beego/beego/config/yaml"
|
||||
// "github.com/beego/beego/config"
|
||||
// )
|
||||
//
|
||||
// cnf, err := config.NewConfig("yaml", "config.yaml")
|
||||
@ -40,7 +40,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/beego/beego/config"
|
||||
"github.com/beego/goyaml2"
|
||||
)
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/beego/beego/config"
|
||||
)
|
||||
|
||||
func TestYaml(t *testing.T) {
|
||||
|
||||
@ -19,7 +19,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/beego/beego/config"
|
||||
)
|
||||
|
||||
func TestDefaults(t *testing.T) {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
// Package context provide the context utils
|
||||
// Usage:
|
||||
//
|
||||
// import "github.com/astaxie/beego/context"
|
||||
// import "github.com/beego/beego/context"
|
||||
//
|
||||
// ctx := context.Context{Request:req,ResponseWriter:rw}
|
||||
//
|
||||
@ -35,7 +35,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
//commonly used mime-types
|
||||
@ -147,7 +147,7 @@ func (ctx *Context) SetSecureCookie(Secret, name, value string, others ...interf
|
||||
// XSRFToken creates a xsrf token string and returns.
|
||||
// others[0] bool secure
|
||||
// others[1] bool http-only
|
||||
func (ctx *Context) XSRFToken(key string, expire int64, others...interface{}) string {
|
||||
func (ctx *Context) XSRFToken(key string, expire int64, others ...interface{}) string {
|
||||
if ctx._xsrfToken == "" {
|
||||
token, ok := ctx.GetSecureCookie(key, "_xsrf")
|
||||
if !ok {
|
||||
@ -157,7 +157,7 @@ func (ctx *Context) XSRFToken(key string, expire int64, others...interface{}) st
|
||||
secure = others[0].(bool)
|
||||
}
|
||||
httpOnly := false
|
||||
if len(others) > 1{
|
||||
if len(others) > 1 {
|
||||
httpOnly = others[1].(bool)
|
||||
}
|
||||
ctx.SetSecureCookie(key, "_xsrf", token, expire, "", "", secure, httpOnly)
|
||||
|
||||
@ -29,7 +29,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
// Regexes for checking the accept headers
|
||||
|
||||
@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
beecontext "github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
beecontext "github.com/beego/beego/context"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
// ConvertParams converts http method params to values that will be passed to the method controller as arguments
|
||||
|
||||
@ -28,9 +28,9 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/context/param"
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/context/param"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -680,8 +680,7 @@ func (c *Controller) XSRFToken() string {
|
||||
if c.XSRFExpire > 0 {
|
||||
expire = int64(c.XSRFExpire)
|
||||
}
|
||||
c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKey, expire,
|
||||
BConfig.WebConfig.XSRFSecure, BConfig.WebConfig.XSRFHttpOnly)
|
||||
c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKey, expire)
|
||||
}
|
||||
return c._xsrfToken
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
func TestGetInt(t *testing.T) {
|
||||
|
||||
2
doc.go
2
doc.go
@ -6,7 +6,7 @@ It is used for rapid development of RESTful APIs, web apps and backend services
|
||||
beego is inspired by Tornado, Sinatra and Flask with the added benefit of some Go-specific features such as interfaces and struct embedding.
|
||||
|
||||
package main
|
||||
import "github.com/astaxie/beego"
|
||||
import "github.com/beego/beego"
|
||||
|
||||
func main() {
|
||||
beego.Run()
|
||||
|
||||
4
error.go
4
error.go
@ -23,8 +23,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
package beego
|
||||
|
||||
import "github.com/astaxie/beego/context"
|
||||
import "github.com/beego/beego/context"
|
||||
|
||||
// FilterFunc defines a filter function which is invoked before the controller handler is executed.
|
||||
type FilterFunc func(*context.Context)
|
||||
|
||||
@ -19,7 +19,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
var FilterUser = func(ctx *context.Context) {
|
||||
|
||||
8
go.mod
8
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/astaxie/beego
|
||||
module github.com/beego/beego
|
||||
|
||||
require (
|
||||
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
|
||||
@ -15,22 +15,18 @@ require (
|
||||
github.com/go-redis/redis v6.14.2+incompatible
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/gogo/protobuf v1.1.1
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
|
||||
github.com/gomodule/redigo v2.0.0+incompatible
|
||||
github.com/hashicorp/golang-lru v0.5.4
|
||||
github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6
|
||||
github.com/lib/pq v1.0.0
|
||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||
github.com/pelletier/go-toml v1.2.0 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.7.0
|
||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
|
||||
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c // indirect
|
||||
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b // indirect
|
||||
github.com/wendal/errors v0.0.0-20181209125328-7f31f4b264ec // indirect
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
)
|
||||
|
||||
|
||||
27
go.sum
27
go.sum
@ -24,18 +24,10 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||
github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d h1:OMrhQqj1QCyDT2sxHCDjE+k8aMdn2ngTCGG7g4wrdLo=
|
||||
github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
|
||||
github.com/couchbase/go-couchbase v0.0.0-20201216133707-c04035124b17 h1:1ZELwRDUvpBpmgKSIUP6VMW1jIehzD0sCdWxRyejegw=
|
||||
github.com/couchbase/go-couchbase v0.0.0-20201216133707-c04035124b17/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A=
|
||||
github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808 h1:8s2l8TVUwMXl6tZMe3+hPCRJ25nQXiA3d1x622JtOqc=
|
||||
github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
|
||||
github.com/couchbase/gomemcached v0.1.1 h1:xCS8ZglJDhrlQg3jmK7Rn1V8f7bPjXABLC05CgLQauc=
|
||||
github.com/couchbase/gomemcached v0.1.1/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo=
|
||||
github.com/couchbase/gomemcached v0.1.2-0.20201224031647-c432ccf49f32 h1:xnKbM9umdDcpWfEsJzVqRf5PGnIMbiZj2OmDYbleQjM=
|
||||
github.com/couchbase/gomemcached v0.1.2-0.20201224031647-c432ccf49f32/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo=
|
||||
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a h1:Y5XsLCEhtEI8qbD9RP3Qlv5FXdTDHxZM9UPUnMRgBp8=
|
||||
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401 h1:4KDlx3vjalrHD/EfsjCpV91HNX3JPaIqRtt83zZ7x+Y=
|
||||
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76 h1:Lgdd/Qp96Qj8jqLpq2cI1I1X7BJnu06efS+XkhRoLUQ=
|
||||
@ -74,9 +66,8 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.0-20170215233205-553a64147049 h1:K9KHZbXKpGydfDN0aZrsoHpLJlZsBrGMFWbgLDGnPZk=
|
||||
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
@ -117,9 +108,8 @@ github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/pelletier/go-toml v1.0.1 h1:0nx4vKBl23+hEaCOV1mFhKS9vhhBtFYWC7rQY0vJAyE=
|
||||
github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@ -159,25 +149,21 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112 h1:NBrpnvz0pDPf3+HXZ1C9GcJd1DTpWDLcLWZhNq6uP7o=
|
||||
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c h1:3eGShk3EQf5gJCYW+WzA0TEJQd37HLOmlYF7N0YJwv0=
|
||||
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
|
||||
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b h1:0Ve0/CCjiAiyKddUMUn3RwIGlq2iTW4GuVzyoKBYO/8=
|
||||
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
||||
github.com/wendal/errors v0.0.0-20181209125328-7f31f4b264ec h1:bua919NvciYmjqfeZMsVkXTny1QvXMrri0X6NlqILRs=
|
||||
github.com/wendal/errors v0.0.0-20181209125328-7f31f4b264ec/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
||||
github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -186,7 +172,6 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
// "net/http"
|
||||
// "os"
|
||||
//
|
||||
// "github.com/astaxie/beego/grace"
|
||||
// "github.com/beego/beego/grace"
|
||||
// )
|
||||
//
|
||||
// func handler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
6
hooks.go
6
hooks.go
@ -6,9 +6,9 @@ import (
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
// register MIME type with content type
|
||||
|
||||
@ -6,7 +6,7 @@ httplib is an libs help you to curl remote url.
|
||||
## GET
|
||||
you can use Get to crawl data.
|
||||
|
||||
import "github.com/astaxie/beego/httplib"
|
||||
import "github.com/beego/beego/httplib"
|
||||
|
||||
str, err := httplib.Get("http://beego.me/").String()
|
||||
if err != nil {
|
||||
@ -94,4 +94,4 @@ httplib support mutil file upload, use `req.PostFile()`
|
||||
|
||||
See godoc for further documentation and examples.
|
||||
|
||||
* [godoc.org/github.com/astaxie/beego/httplib](https://godoc.org/github.com/astaxie/beego/httplib)
|
||||
* [godoc.org/github.com/beego/beego/httplib](https://godoc.org/github.com/beego/beego/httplib)
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
// Package httplib is used as http.Client
|
||||
// Usage:
|
||||
//
|
||||
// import "github.com/astaxie/beego/httplib"
|
||||
// import "github.com/beego/beego/httplib"
|
||||
//
|
||||
// b := httplib.Post("http://beego.me/")
|
||||
// b.Param("username","astaxie")
|
||||
|
||||
34
log.go
34
log.go
@ -17,11 +17,11 @@ package beego
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
// Log levels to control the logging output.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
const (
|
||||
LevelEmergency = iota
|
||||
LevelAlert
|
||||
@ -34,90 +34,90 @@ const (
|
||||
)
|
||||
|
||||
// BeeLogger references the used application logger.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
var BeeLogger = logs.GetBeeLogger()
|
||||
|
||||
// SetLevel sets the global log level used by the simple logger.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func SetLevel(l int) {
|
||||
logs.SetLevel(l)
|
||||
}
|
||||
|
||||
// SetLogFuncCall set the CallDepth, default is 3
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func SetLogFuncCall(b bool) {
|
||||
logs.SetLogFuncCall(b)
|
||||
}
|
||||
|
||||
// SetLogger sets a new logger.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func SetLogger(adaptername string, config string) error {
|
||||
return logs.SetLogger(adaptername, config)
|
||||
}
|
||||
|
||||
// Emergency logs a message at emergency level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Emergency(v ...interface{}) {
|
||||
logs.Emergency(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Alert logs a message at alert level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Alert(v ...interface{}) {
|
||||
logs.Alert(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Critical logs a message at critical level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Critical(v ...interface{}) {
|
||||
logs.Critical(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Error logs a message at error level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Error(v ...interface{}) {
|
||||
logs.Error(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Warning logs a message at warning level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Warning(v ...interface{}) {
|
||||
logs.Warning(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Warn compatibility alias for Warning()
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Warn(v ...interface{}) {
|
||||
logs.Warn(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Notice logs a message at notice level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Notice(v ...interface{}) {
|
||||
logs.Notice(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Informational logs a message at info level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Informational(v ...interface{}) {
|
||||
logs.Informational(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Info compatibility alias for Warning()
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Info(v ...interface{}) {
|
||||
logs.Info(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Debug logs a message at debug level.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Debug(v ...interface{}) {
|
||||
logs.Debug(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
// Trace logs a message at trace level.
|
||||
// compatibility alias for Warning()
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/beego/beego/logs instead.
|
||||
func Trace(v ...interface{}) {
|
||||
logs.Trace(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ logs is a Go logs manager. It can use many logs adapters. The repo is inspired b
|
||||
|
||||
## How to install?
|
||||
|
||||
go get github.com/astaxie/beego/logs
|
||||
go get github.com/beego/beego/logs
|
||||
|
||||
|
||||
## What adapters are supported?
|
||||
@ -18,7 +18,7 @@ First you must import it
|
||||
|
||||
```golang
|
||||
import (
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"github.com/elastic/go-elasticsearch/v6"
|
||||
"github.com/elastic/go-elasticsearch/v6/esapi"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
// NewES return a LoggerInterface
|
||||
@ -28,7 +28,7 @@ func NewES() logs.Logger {
|
||||
// please import this package
|
||||
// usually means that you can import this package in your main package
|
||||
// for example, anonymous:
|
||||
// import _ "github.com/astaxie/beego/logs/es"
|
||||
// import _ "github.com/beego/beego/logs/es"
|
||||
type esLogger struct {
|
||||
*elasticsearch.Client
|
||||
DSN string `json:"dsn"`
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
// Package logs provide a general log interface
|
||||
// Usage:
|
||||
//
|
||||
// import "github.com/astaxie/beego/logs"
|
||||
// import "github.com/beego/beego/logs"
|
||||
//
|
||||
// log := NewLogger(10000)
|
||||
// log.SetLogger("console", "")
|
||||
|
||||
@ -23,8 +23,8 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
func PrometheusMiddleWare(next http.Handler) http.Handler {
|
||||
|
||||
@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
func TestPrometheusMiddleWare(t *testing.T) {
|
||||
|
||||
@ -17,7 +17,7 @@ package migration
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
// Index struct defines the structure of Index Columns
|
||||
|
||||
@ -33,8 +33,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/orm"
|
||||
)
|
||||
|
||||
// const the data format for the bee generate migration datatype
|
||||
|
||||
28
namespace.go
28
namespace.go
@ -18,7 +18,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
beecontext "github.com/astaxie/beego/context"
|
||||
beecontext "github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
type namespaceCond func(*beecontext.Context) bool
|
||||
@ -97,91 +97,91 @@ func (n *Namespace) Filter(action string, filter ...FilterFunc) *Namespace {
|
||||
}
|
||||
|
||||
// Router same as beego.Rourer
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Router
|
||||
// refer: https://godoc.org/github.com/beego/beego#Router
|
||||
func (n *Namespace) Router(rootpath string, c ControllerInterface, mappingMethods ...string) *Namespace {
|
||||
n.handlers.Add(rootpath, c, mappingMethods...)
|
||||
return n
|
||||
}
|
||||
|
||||
// AutoRouter same as beego.AutoRouter
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#AutoRouter
|
||||
// refer: https://godoc.org/github.com/beego/beego#AutoRouter
|
||||
func (n *Namespace) AutoRouter(c ControllerInterface) *Namespace {
|
||||
n.handlers.AddAuto(c)
|
||||
return n
|
||||
}
|
||||
|
||||
// AutoPrefix same as beego.AutoPrefix
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#AutoPrefix
|
||||
// refer: https://godoc.org/github.com/beego/beego#AutoPrefix
|
||||
func (n *Namespace) AutoPrefix(prefix string, c ControllerInterface) *Namespace {
|
||||
n.handlers.AddAutoPrefix(prefix, c)
|
||||
return n
|
||||
}
|
||||
|
||||
// Get same as beego.Get
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Get
|
||||
// refer: https://godoc.org/github.com/beego/beego#Get
|
||||
func (n *Namespace) Get(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Get(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Post same as beego.Post
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Post
|
||||
// refer: https://godoc.org/github.com/beego/beego#Post
|
||||
func (n *Namespace) Post(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Post(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Delete same as beego.Delete
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Delete
|
||||
// refer: https://godoc.org/github.com/beego/beego#Delete
|
||||
func (n *Namespace) Delete(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Delete(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Put same as beego.Put
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Put
|
||||
// refer: https://godoc.org/github.com/beego/beego#Put
|
||||
func (n *Namespace) Put(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Put(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Head same as beego.Head
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Head
|
||||
// refer: https://godoc.org/github.com/beego/beego#Head
|
||||
func (n *Namespace) Head(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Head(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Options same as beego.Options
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Options
|
||||
// refer: https://godoc.org/github.com/beego/beego#Options
|
||||
func (n *Namespace) Options(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Options(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Patch same as beego.Patch
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Patch
|
||||
// refer: https://godoc.org/github.com/beego/beego#Patch
|
||||
func (n *Namespace) Patch(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Patch(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Any same as beego.Any
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Any
|
||||
// refer: https://godoc.org/github.com/beego/beego#Any
|
||||
func (n *Namespace) Any(rootpath string, f FilterFunc) *Namespace {
|
||||
n.handlers.Any(rootpath, f)
|
||||
return n
|
||||
}
|
||||
|
||||
// Handler same as beego.Handler
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Handler
|
||||
// refer: https://godoc.org/github.com/beego/beego#Handler
|
||||
func (n *Namespace) Handler(rootpath string, h http.Handler) *Namespace {
|
||||
n.handlers.Handler(rootpath, h)
|
||||
return n
|
||||
}
|
||||
|
||||
// Include add include class
|
||||
// refer: https://godoc.org/github.com/astaxie/beego#Include
|
||||
// refer: https://godoc.org/github.com/beego/beego#Include
|
||||
func (n *Namespace) Include(cList ...ControllerInterface) *Namespace {
|
||||
n.handlers.Include(cList...)
|
||||
return n
|
||||
|
||||
@ -20,7 +20,7 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
func TestNamespaceGet(t *testing.T) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# beego orm
|
||||
|
||||
[](https://drone.io/github.com/astaxie/beego/latest)
|
||||
[](https://drone.io/github.com/beego/beego/latest)
|
||||
|
||||
A powerful orm framework for go.
|
||||
|
||||
@ -27,7 +27,7 @@ more features please read the docs
|
||||
|
||||
**Install:**
|
||||
|
||||
go get github.com/astaxie/beego/orm
|
||||
go get github.com/beego/beego/orm
|
||||
|
||||
## Changelog
|
||||
|
||||
@ -45,7 +45,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/beego/beego/orm"
|
||||
_ "github.com/go-sql-driver/mysql" // import your used driver
|
||||
)
|
||||
|
||||
|
||||
@ -193,7 +193,7 @@ checkType:
|
||||
}
|
||||
fieldType = f.FieldType()
|
||||
if fieldType&IsRelField > 0 {
|
||||
err = fmt.Errorf("unsupport type custom field, please refer to https://github.com/astaxie/beego/blob/master/orm/models_fields.go#L24-L42")
|
||||
err = fmt.Errorf("unsupport type custom field, please refer to https://github.com/beego/beego/blob/master/orm/models_fields.go#L24-L42")
|
||||
goto end
|
||||
}
|
||||
default:
|
||||
|
||||
@ -301,7 +301,7 @@ type Post struct {
|
||||
Content string `orm:"type(text)"`
|
||||
Created time.Time `orm:"auto_now_add"`
|
||||
Updated time.Time `orm:"auto_now"`
|
||||
Tags []*Tag `orm:"rel(m2m);rel_through(github.com/astaxie/beego/orm.PostTags)"`
|
||||
Tags []*Tag `orm:"rel(m2m);rel_through(github.com/beego/beego/orm.PostTags)"`
|
||||
}
|
||||
|
||||
func (u *Post) TableIndex() [][]string {
|
||||
@ -359,7 +359,7 @@ type Group struct {
|
||||
type Permission struct {
|
||||
ID int `orm:"column(id)"`
|
||||
Name string
|
||||
Groups []*Group `orm:"rel(m2m);rel_through(github.com/astaxie/beego/orm.GroupPermissions)"`
|
||||
Groups []*Group `orm:"rel(m2m);rel_through(github.com/beego/beego/orm.GroupPermissions)"`
|
||||
}
|
||||
|
||||
type GroupPermissions struct {
|
||||
@ -454,7 +454,7 @@ var (
|
||||
|
||||
usage:
|
||||
|
||||
go get -u github.com/astaxie/beego/orm
|
||||
go get -u github.com/beego/beego/orm
|
||||
go get -u github.com/go-sql-driver/mysql
|
||||
go get -u github.com/mattn/go-sqlite3
|
||||
go get -u github.com/lib/pq
|
||||
@ -464,25 +464,25 @@ var (
|
||||
mysql -u root -e 'create database orm_test;'
|
||||
export ORM_DRIVER=mysql
|
||||
export ORM_SOURCE="root:@/orm_test?charset=utf8"
|
||||
go test -v github.com/astaxie/beego/orm
|
||||
go test -v github.com/beego/beego/orm
|
||||
|
||||
|
||||
#### Sqlite3
|
||||
export ORM_DRIVER=sqlite3
|
||||
export ORM_SOURCE='file:memory_test?mode=memory'
|
||||
go test -v github.com/astaxie/beego/orm
|
||||
go test -v github.com/beego/beego/orm
|
||||
|
||||
|
||||
#### PostgreSQL
|
||||
psql -c 'create database orm_test;' -U postgres
|
||||
export ORM_DRIVER=postgres
|
||||
export ORM_SOURCE="user=postgres dbname=orm_test sslmode=disable"
|
||||
go test -v github.com/astaxie/beego/orm
|
||||
go test -v github.com/beego/beego/orm
|
||||
|
||||
#### TiDB
|
||||
export ORM_DRIVER=tidb
|
||||
export ORM_SOURCE='memory://test/test'
|
||||
go test -v github.com/astaxie/beego/orm
|
||||
go test -v github.com/beego/beego/orm
|
||||
|
||||
`
|
||||
)
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
//
|
||||
// import (
|
||||
// "fmt"
|
||||
// "github.com/astaxie/beego/orm"
|
||||
// "github.com/beego/beego/orm"
|
||||
// _ "github.com/go-sql-driver/mysql" // import your used driver
|
||||
// )
|
||||
//
|
||||
|
||||
10
parser.go
10
parser.go
@ -30,16 +30,16 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/astaxie/beego/context/param"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/context/param"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
var globalRouterTemplate = `package {{.routersDir}}
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context/param"{{.globalimport}}
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context/param"{{.globalimport}}
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
//
|
||||
// Simple Usage:
|
||||
// import(
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/plugins/apiauth"
|
||||
// "github.com/beego/beego"
|
||||
// "github.com/beego/beego/plugins/apiauth"
|
||||
// )
|
||||
//
|
||||
// func main(){
|
||||
@ -65,8 +65,8 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
// AppIDToAppSecret is used to get appsecret throw appid
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
// Package auth provides handlers to enable basic auth support.
|
||||
// Simple Usage:
|
||||
// import(
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/plugins/auth"
|
||||
// "github.com/beego/beego"
|
||||
// "github.com/beego/beego/plugins/auth"
|
||||
// )
|
||||
//
|
||||
// func main(){
|
||||
@ -40,8 +40,8 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
var defaultRealm = "Authorization Required"
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
// Package authz provides handlers to enable ACL, RBAC, ABAC authorization support.
|
||||
// Simple Usage:
|
||||
// import(
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/plugins/authz"
|
||||
// "github.com/beego/beego"
|
||||
// "github.com/beego/beego/plugins/authz"
|
||||
// "github.com/casbin/casbin"
|
||||
// )
|
||||
//
|
||||
@ -42,8 +42,8 @@ package authz
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/casbin/casbin"
|
||||
)
|
||||
|
||||
|
||||
@ -19,9 +19,9 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/plugins/auth"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/plugins/auth"
|
||||
"github.com/casbin/casbin"
|
||||
)
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
// Package cors provides handlers to enable CORS support.
|
||||
// Usage
|
||||
// import (
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/plugins/cors"
|
||||
// "github.com/beego/beego"
|
||||
// "github.com/beego/beego/plugins/cors"
|
||||
// )
|
||||
//
|
||||
// func main() {
|
||||
@ -42,8 +42,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@ -21,8 +21,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
// HTTPHeaderGuardRecorder is httptest.ResponseRecorder with own http.Header
|
||||
|
||||
@ -17,7 +17,7 @@ package beego
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
// PolicyFunc defines a policy function which is invoked before the controller handler is executed.
|
||||
|
||||
10
router.go
10
router.go
@ -27,11 +27,11 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
beecontext "github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/context/param"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/toolbox"
|
||||
"github.com/astaxie/beego/utils"
|
||||
beecontext "github.com/beego/beego/context"
|
||||
"github.com/beego/beego/context/param"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/toolbox"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
// default filter execution points
|
||||
|
||||
@ -21,8 +21,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
type TestController struct {
|
||||
|
||||
@ -86,9 +86,9 @@ CURRENT_BRANCH=${CURRENT_BRANCH:2}
|
||||
|
||||
BUILD_TIME=$(date +%Y-%m-%d--%T)
|
||||
|
||||
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X github.com/astaxie/beego.GoVersion=${go_version[2]:2}"
|
||||
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X github.com/astaxie/beego.GitBranch=${CURRENT_BRANCH}"
|
||||
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X github.com/astaxie/beego.BuildTime=$BUILD_TIME"
|
||||
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X github.com/beego/beego.GoVersion=${go_version[2]:2}"
|
||||
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X github.com/beego/beego.GitBranch=${CURRENT_BRANCH}"
|
||||
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X github.com/beego/beego.BuildTime=$BUILD_TIME"
|
||||
|
||||
OPTIMIZATION_FLAGS="-trimpath"
|
||||
if [ "${DEBUG}" == "1" ]; then
|
||||
|
||||
@ -46,7 +46,7 @@ fi
|
||||
|
||||
GIT_DESCRIBE_TAG=$(git describe --tags)
|
||||
|
||||
echo "github.com/astaxie/beego.BuildVersion=${VERSION}"
|
||||
echo "github.com/astaxie/beego.BuildGitRevision=${BUILD_GIT_REVISION}"
|
||||
echo "github.com/astaxie/beego.BuildStatus=${tree_status}"
|
||||
echo "github.com/astaxie/beego.BuildTag=${GIT_DESCRIBE_TAG}"
|
||||
echo "github.com/beego/beego.BuildVersion=${VERSION}"
|
||||
echo "github.com/beego/beego.BuildGitRevision=${BUILD_GIT_REVISION}"
|
||||
echo "github.com/beego/beego.BuildStatus=${tree_status}"
|
||||
echo "github.com/beego/beego.BuildTag=${GIT_DESCRIBE_TAG}"
|
||||
@ -5,7 +5,7 @@ session is a Go session manager. It can use many session providers. Just like th
|
||||
|
||||
## How to install?
|
||||
|
||||
go get github.com/astaxie/beego/session
|
||||
go get github.com/beego/beego/session
|
||||
|
||||
|
||||
## What providers are supported?
|
||||
@ -18,7 +18,7 @@ As of now this session manager support memory, file, Redis and MySQL.
|
||||
First you must import it
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
Then in you web app init the global session manager
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/couchbase"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/couchbase"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -39,7 +39,7 @@ import (
|
||||
|
||||
couchbase "github.com/couchbase/go-couchbase"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
var couchbpder = &Provider{}
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"github.com/ledisdb/ledisdb/config"
|
||||
"github.com/ledisdb/ledisdb/ledis"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/memcache"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/memcache"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -37,7 +37,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
|
||||
"github.com/bradfitz/gomemcache/memcache"
|
||||
)
|
||||
|
||||
@ -28,8 +28,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/mysql"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/mysql"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -46,7 +46,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
// import mysql driver
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/postgresql"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/postgresql"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -56,7 +56,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
// import postgresql Driver
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/redis"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/redis"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -39,7 +39,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/redis_cluster"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/redis_cluster"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -39,7 +39,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
rediss "github.com/go-redis/redis"
|
||||
)
|
||||
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// _ "github.com/astaxie/beego/session/redis_sentinel"
|
||||
// "github.com/astaxie/beego/session"
|
||||
// _ "github.com/beego/beego/session/redis_sentinel"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
@ -39,7 +39,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
"github.com/go-redis/redis"
|
||||
)
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
func TestRedisSentinel(t *testing.T) {
|
||||
|
||||
@ -29,7 +29,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
//
|
||||
// Usage:
|
||||
// import(
|
||||
// "github.com/astaxie/beego/session"
|
||||
// "github.com/beego/beego/session"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/beego/beego/session"
|
||||
"github.com/ssdb/gossdb/ssdb"
|
||||
)
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/hashicorp/golang-lru"
|
||||
)
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -21,7 +21,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/testdata"
|
||||
"github.com/beego/beego/testdata"
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
)
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/httplib"
|
||||
"github.com/beego/beego/config"
|
||||
"github.com/beego/beego/httplib"
|
||||
)
|
||||
|
||||
var port = ""
|
||||
|
||||
4
tree.go
4
tree.go
@ -19,8 +19,8 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -18,7 +18,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
type testinfo struct {
|
||||
|
||||
@ -6,9 +6,9 @@ an example for use captcha
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/astaxie/beego/utils/captcha"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/cache"
|
||||
"github.com/beego/beego/utils/captcha"
|
||||
)
|
||||
|
||||
var cpt *captcha.Captcha
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
// package controllers
|
||||
//
|
||||
// import (
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/cache"
|
||||
// "github.com/astaxie/beego/utils/captcha"
|
||||
// "github.com/beego/beego"
|
||||
// "github.com/beego/beego/cache"
|
||||
// "github.com/beego/beego/utils/captcha"
|
||||
// )
|
||||
//
|
||||
// var cpt *captcha.Captcha
|
||||
@ -66,11 +66,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego"
|
||||
"github.com/beego/beego/cache"
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/beego/beego/logs"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -17,7 +17,7 @@ package captcha
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/beego/beego/utils"
|
||||
)
|
||||
|
||||
type byteCounter struct {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
package pagination
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/beego/beego/context"
|
||||
)
|
||||
|
||||
// SetPaginator Instantiates a Paginator and assigns it to context.Input.Data("paginator").
|
||||
|
||||
@ -8,7 +8,7 @@ In your beego.Controller:
|
||||
|
||||
package controllers
|
||||
|
||||
import "github.com/astaxie/beego/utils/pagination"
|
||||
import "github.com/beego/beego/utils/pagination"
|
||||
|
||||
type PostsController struct {
|
||||
beego.Controller
|
||||
|
||||
@ -7,18 +7,18 @@ validation is a form validation for a data validation and error collecting using
|
||||
|
||||
Install:
|
||||
|
||||
go get github.com/astaxie/beego/validation
|
||||
go get github.com/beego/beego/validation
|
||||
|
||||
Test:
|
||||
|
||||
go test github.com/astaxie/beego/validation
|
||||
go test github.com/beego/beego/validation
|
||||
|
||||
## Example
|
||||
|
||||
Direct Use:
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/validation"
|
||||
"github.com/beego/beego/validation"
|
||||
"log"
|
||||
)
|
||||
|
||||
@ -49,7 +49,7 @@ Direct Use:
|
||||
Struct Tag Use:
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/validation"
|
||||
"github.com/beego/beego/validation"
|
||||
)
|
||||
|
||||
// validation function follow with "valid" tag
|
||||
@ -81,7 +81,7 @@ Struct Tag Use:
|
||||
Use custom function:
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/validation"
|
||||
"github.com/beego/beego/validation"
|
||||
)
|
||||
|
||||
type user struct {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
// Package validation for validations
|
||||
//
|
||||
// import (
|
||||
// "github.com/astaxie/beego/validation"
|
||||
// "github.com/beego/beego/validation"
|
||||
// "log"
|
||||
// )
|
||||
//
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/beego/logs"
|
||||
)
|
||||
|
||||
// CanSkipFuncs will skip valid if RequiredFirst is true and the struct field's value is empty
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user