mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 02:20:54 +00:00
uing pkg module
This commit is contained in:
parent
7312197732
commit
aa06a10493
@ -54,16 +54,22 @@ import (
|
||||
|
||||
const (
|
||||
// PreSignal is the position to add filter before signal
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
PreSignal = iota
|
||||
// PostSignal is the position to add filter after signal
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
PostSignal
|
||||
// StateInit represent the application inited
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
StateInit
|
||||
// StateRunning represent the application is running
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
StateRunning
|
||||
// StateShuttingDown represent the application is shutting down
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
StateShuttingDown
|
||||
// StateTerminate represent the application is killed
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
StateTerminate
|
||||
)
|
||||
|
||||
@ -106,6 +112,7 @@ func init() {
|
||||
}
|
||||
|
||||
// NewServer returns a new graceServer.
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func NewServer(addr string, handler http.Handler) (srv *Server) {
|
||||
regLock.Lock()
|
||||
defer regLock.Unlock()
|
||||
@ -154,12 +161,14 @@ func NewServer(addr string, handler http.Handler) (srv *Server) {
|
||||
}
|
||||
|
||||
// ListenAndServe refer http.ListenAndServe
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func ListenAndServe(addr string, handler http.Handler) error {
|
||||
server := NewServer(addr, handler)
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
|
||||
// ListenAndServeTLS refer http.ListenAndServeTLS
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func ListenAndServeTLS(addr string, certFile string, keyFile string, handler http.Handler) error {
|
||||
server := NewServer(addr, handler)
|
||||
return server.ListenAndServeTLS(certFile, keyFile)
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
// Server embedded http.Server
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
type Server struct {
|
||||
*http.Server
|
||||
ln net.Listener
|
||||
@ -32,6 +33,7 @@ type Server struct {
|
||||
// Serve accepts incoming connections on the Listener l,
|
||||
// creating a new service goroutine for each.
|
||||
// The service goroutines read requests and then call srv.Handler to reply to them.
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func (srv *Server) Serve() (err error) {
|
||||
srv.state = StateRunning
|
||||
defer func() { srv.state = StateTerminate }()
|
||||
@ -55,6 +57,7 @@ func (srv *Server) Serve() (err error) {
|
||||
// ListenAndServe listens on the TCP network address srv.Addr and then calls Serve
|
||||
// to handle requests on incoming connections. If srv.Addr is blank, ":http" is
|
||||
// used.
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func (srv *Server) ListenAndServe() (err error) {
|
||||
addr := srv.Addr
|
||||
if addr == "" {
|
||||
@ -94,6 +97,7 @@ func (srv *Server) ListenAndServe() (err error) {
|
||||
// CA's certificate.
|
||||
//
|
||||
// If srv.Addr is blank, ":https" is used.
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
|
||||
addr := srv.Addr
|
||||
if addr == "" {
|
||||
@ -140,6 +144,7 @@ func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
|
||||
|
||||
// ListenAndServeMutualTLS listens on the TCP network address srv.Addr and then calls
|
||||
// Serve to handle requests on incoming mutual TLS connections.
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func (srv *Server) ListenAndServeMutualTLS(certFile, keyFile, trustFile string) (err error) {
|
||||
addr := srv.Addr
|
||||
if addr == "" {
|
||||
@ -340,6 +345,7 @@ func (srv *Server) fork() (err error) {
|
||||
}
|
||||
|
||||
// RegisterSignalHook registers a function to be run PreSignal or PostSignal for a given signal.
|
||||
// Deprecated: using pkg/grace, we will delete this in v2.1.0
|
||||
func (srv *Server) RegisterSignalHook(ppFlag int, sig os.Signal, f func()) (err error) {
|
||||
if ppFlag != PreSignal && ppFlag != PostSignal {
|
||||
err = fmt.Errorf("Invalid ppFlag argument. Must be either grace.PreSignal or grace.PostSignal")
|
||||
|
@ -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/astaxie/beego/pkg/grace"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/toolbox"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
// BeeAdminApp is the default adminApp used by admin module.
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/toolbox"
|
||||
"github.com/astaxie/beego/pkg/toolbox"
|
||||
)
|
||||
|
||||
type SampleDatabaseCheck struct {
|
||||
|
@ -27,10 +27,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/grace"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"golang.org/x/crypto/acme/autocert"
|
||||
|
||||
"github.com/astaxie/beego/pkg/grace"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
3
pkg/cache/memcache/memcache.go
vendored
3
pkg/cache/memcache/memcache.go
vendored
@ -35,8 +35,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/bradfitz/gomemcache/memcache"
|
||||
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
)
|
||||
|
||||
// Cache Memcache adapter.
|
||||
|
2
pkg/cache/memcache/memcache_test.go
vendored
2
pkg/cache/memcache/memcache_test.go
vendored
@ -21,7 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
)
|
||||
|
||||
func TestMemcacheCache(t *testing.T) {
|
||||
|
4
pkg/cache/redis/redis.go
vendored
4
pkg/cache/redis/redis.go
vendored
@ -34,12 +34,12 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"strings"
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
|
3
pkg/cache/redis/redis_test.go
vendored
3
pkg/cache/redis/redis_test.go
vendored
@ -19,9 +19,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
)
|
||||
|
||||
func TestRedisCache(t *testing.T) {
|
||||
|
2
pkg/cache/ssdb/ssdb.go
vendored
2
pkg/cache/ssdb/ssdb.go
vendored
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/ssdb/gossdb/ssdb"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
)
|
||||
|
||||
// Cache SSDB adapter
|
||||
|
2
pkg/cache/ssdb/ssdb_test.go
vendored
2
pkg/cache/ssdb/ssdb_test.go
vendored
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
)
|
||||
|
||||
func TestSsdbcacheCache(t *testing.T) {
|
||||
|
@ -22,11 +22,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/astaxie/beego/pkg/config"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
// Config is the main struct for BConfig
|
||||
|
2
pkg/config/env/env.go
vendored
2
pkg/config/env/env.go
vendored
@ -21,7 +21,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
var env *utils.BeeMap
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
package ini
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
@ -26,6 +26,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -45,7 +47,7 @@ type IniConfig struct {
|
||||
}
|
||||
|
||||
// Parse creates a new Config and parses the file configuration from the named file.
|
||||
func (ini *IniConfig) Parse(name string) (Configer, error) {
|
||||
func (ini *IniConfig) Parse(name string) (config.Configer, error) {
|
||||
return ini.parseFile(name)
|
||||
}
|
||||
|
||||
@ -195,7 +197,7 @@ func (ini *IniConfig) parseData(dir string, data []byte) (*IniConfigContainer, e
|
||||
val = bytes.Trim(val, `"`)
|
||||
}
|
||||
|
||||
cfg.data[section][key] = ExpandValueEnv(string(val))
|
||||
cfg.data[section][key] = config.ExpandValueEnv(string(val))
|
||||
if comment.Len() > 0 {
|
||||
cfg.keyComment[section+"."+key] = comment.String()
|
||||
comment.Reset()
|
||||
@ -208,7 +210,7 @@ func (ini *IniConfig) parseData(dir string, data []byte) (*IniConfigContainer, e
|
||||
// ParseData parse ini the data
|
||||
// When include other.conf,other.conf is either absolute directory
|
||||
// or under beego in default temporary directory(/tmp/beego[-username]).
|
||||
func (ini *IniConfig) ParseData(data []byte) (Configer, error) {
|
||||
func (ini *IniConfig) ParseData(data []byte) (config.Configer, error) {
|
||||
dir := "beego"
|
||||
currentUser, err := user.Current()
|
||||
if err == nil {
|
||||
@ -233,7 +235,7 @@ type IniConfigContainer struct {
|
||||
|
||||
// Bool returns the boolean value for a given key.
|
||||
func (c *IniConfigContainer) Bool(key string) (bool, error) {
|
||||
return ParseBool(c.getdata(key))
|
||||
return config.ParseBool(c.getdata(key))
|
||||
}
|
||||
|
||||
// DefaultBool returns the boolean value for a given key.
|
||||
@ -500,5 +502,5 @@ func (c *IniConfigContainer) getdata(key string) string {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Register("ini", &IniConfig{})
|
||||
config.Register("ini", &IniConfig{})
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
package ini
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -20,6 +20,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
)
|
||||
|
||||
func TestIni(t *testing.T) {
|
||||
@ -92,7 +94,7 @@ password = ${GOPATH}
|
||||
}
|
||||
f.Close()
|
||||
defer os.Remove("testini.conf")
|
||||
iniconf, err := NewConfig("ini", "testini.conf")
|
||||
iniconf, err := config.NewConfig("ini", "testini.conf")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -165,7 +167,7 @@ httpport=8080
|
||||
name=mysql
|
||||
`
|
||||
)
|
||||
cfg, err := NewConfigData("ini", []byte(inicontext))
|
||||
cfg, err := config.NewConfigData("ini", []byte(inicontext))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
package json
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@ -23,6 +23,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
)
|
||||
|
||||
// JSONConfig is a json config parser and implements Config interface.
|
||||
@ -30,7 +32,7 @@ type JSONConfig struct {
|
||||
}
|
||||
|
||||
// Parse returns a ConfigContainer with parsed json config map.
|
||||
func (js *JSONConfig) Parse(filename string) (Configer, error) {
|
||||
func (js *JSONConfig) Parse(filename string) (config.Configer, error) {
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -45,7 +47,7 @@ func (js *JSONConfig) Parse(filename string) (Configer, error) {
|
||||
}
|
||||
|
||||
// ParseData returns a ConfigContainer with json string
|
||||
func (js *JSONConfig) ParseData(data []byte) (Configer, error) {
|
||||
func (js *JSONConfig) ParseData(data []byte) (config.Configer, error) {
|
||||
x := &JSONConfigContainer{
|
||||
data: make(map[string]interface{}),
|
||||
}
|
||||
@ -59,7 +61,7 @@ func (js *JSONConfig) ParseData(data []byte) (Configer, error) {
|
||||
x.data["rootArray"] = wrappingArray
|
||||
}
|
||||
|
||||
x.data = ExpandValueEnvForMap(x.data)
|
||||
x.data = config.ExpandValueEnvForMap(x.data)
|
||||
|
||||
return x, nil
|
||||
}
|
||||
@ -75,7 +77,7 @@ type JSONConfigContainer struct {
|
||||
func (c *JSONConfigContainer) Bool(key string) (bool, error) {
|
||||
val := c.getData(key)
|
||||
if val != nil {
|
||||
return ParseBool(val)
|
||||
return config.ParseBool(val)
|
||||
}
|
||||
return false, fmt.Errorf("not exist key: %q", key)
|
||||
}
|
||||
@ -265,5 +267,5 @@ func (c *JSONConfigContainer) getData(key string) interface{} {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Register("json", &JSONConfig{})
|
||||
config.Register("json", &JSONConfig{})
|
||||
}
|
@ -12,12 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
package json
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
)
|
||||
|
||||
func TestJsonStartsWithArray(t *testing.T) {
|
||||
@ -43,7 +45,7 @@ func TestJsonStartsWithArray(t *testing.T) {
|
||||
}
|
||||
f.Close()
|
||||
defer os.Remove("testjsonWithArray.conf")
|
||||
jsonconf, err := NewConfig("json", "testjsonWithArray.conf")
|
||||
jsonconf, err := config.NewConfig("json", "testjsonWithArray.conf")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -143,7 +145,7 @@ func TestJson(t *testing.T) {
|
||||
}
|
||||
f.Close()
|
||||
defer os.Remove("testjson.conf")
|
||||
jsonconf, err := NewConfig("json", "testjson.conf")
|
||||
jsonconf, err := config.NewConfig("json", "testjson.conf")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
@ -39,7 +39,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
"github.com/beego/x2j"
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
)
|
||||
|
||||
func TestXML(t *testing.T) {
|
||||
|
@ -40,7 +40,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
"github.com/beego/goyaml2"
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
)
|
||||
|
||||
func TestYaml(t *testing.T) {
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/config"
|
||||
beeJson "github.com/astaxie/beego/pkg/config/json"
|
||||
)
|
||||
|
||||
func TestDefaults(t *testing.T) {
|
||||
@ -35,7 +35,7 @@ func TestDefaults(t *testing.T) {
|
||||
func TestAssignConfig_01(t *testing.T) {
|
||||
_BConfig := &Config{}
|
||||
_BConfig.AppName = "beego_test"
|
||||
jcf := &config.JSONConfig{}
|
||||
jcf := &beeJson.JSONConfig{}
|
||||
ac, _ := jcf.ParseData([]byte(`{"AppName":"beego_json"}`))
|
||||
assignSingleConfig(_BConfig, ac)
|
||||
if _BConfig.AppName != "beego_json" {
|
||||
@ -73,7 +73,7 @@ func TestAssignConfig_02(t *testing.T) {
|
||||
configMap["SessionProviderConfig"] = "file"
|
||||
configMap["FileLineNum"] = true
|
||||
|
||||
jcf := &config.JSONConfig{}
|
||||
jcf := &beeJson.JSONConfig{}
|
||||
bs, _ = json.Marshal(configMap)
|
||||
ac, _ := jcf.ParseData(bs)
|
||||
|
||||
@ -109,7 +109,7 @@ func TestAssignConfig_02(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAssignConfig_03(t *testing.T) {
|
||||
jcf := &config.JSONConfig{}
|
||||
jcf := &beeJson.JSONConfig{}
|
||||
ac, _ := jcf.ParseData([]byte(`{"AppName":"beego"}`))
|
||||
ac.Set("AppName", "test_app")
|
||||
ac.Set("RunMode", "online")
|
||||
|
@ -35,7 +35,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
//commonly used mime-types
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/context/param"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
@ -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/astaxie/beego/pkg"
|
||||
|
||||
func main() {
|
||||
beego.Run()
|
||||
|
@ -23,8 +23,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
package beego
|
||||
|
||||
import "github.com/astaxie/beego/context"
|
||||
import "github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
var FilterUser = func(ctx *context.Context) {
|
||||
|
@ -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/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
)
|
||||
|
||||
// register MIME type with content type
|
||||
|
34
pkg/log.go
34
pkg/log.go
@ -17,11 +17,11 @@ package beego
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
)
|
||||
|
||||
// Log levels to control the logging output.
|
||||
// Deprecated: use github.com/astaxie/beego/logs instead.
|
||||
// Deprecated: use github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/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/astaxie/beego/pkg/logs instead.
|
||||
func Trace(v ...interface{}) {
|
||||
logs.Trace(generateFmtStr(len(v)), v...)
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/logs"
|
||||
)
|
||||
|
||||
// NewES return a LoggerInterface
|
||||
|
@ -23,8 +23,8 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
func TestPrometheusMiddleWare(t *testing.T) {
|
||||
|
@ -17,7 +17,7 @@ package migration
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/orm"
|
||||
)
|
||||
|
||||
// const the data format for the bee generate migration datatype
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
beecontext "github.com/astaxie/beego/context"
|
||||
beecontext "github.com/astaxie/beego/pkg/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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg#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/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
func TestNamespaceGet(t *testing.T) {
|
||||
|
@ -63,7 +63,7 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
)
|
||||
|
||||
// DebugQueries define the debug
|
||||
|
@ -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/astaxie/beego/pkg/context/param"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
var globalRouterTemplate = `package {{.routersDir}}
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context/param"{{.globalimport}}
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context/param"{{.globalimport}}
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -65,8 +65,8 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
// AppIDToAppSecret is used to get appsecret throw appid
|
||||
|
@ -40,8 +40,8 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
var defaultRealm = "Authorization Required"
|
||||
|
@ -40,8 +40,8 @@
|
||||
package authz
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/casbin/casbin"
|
||||
"net/http"
|
||||
)
|
||||
|
@ -15,9 +15,9 @@
|
||||
package authz
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/plugins/auth"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/plugins/auth"
|
||||
"github.com/casbin/casbin"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -42,8 +42,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
// HTTPHeaderGuardRecorder is httptest.ResponseRecorder with own http.Header
|
||||
|
@ -17,7 +17,7 @@ package beego
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
// PolicyFunc defines a policy function which is invoked before the controller handler is executed.
|
||||
|
@ -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/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/context/param"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/toolbox"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
// default filter execution points
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
)
|
||||
|
||||
type TestController struct {
|
||||
|
@ -39,7 +39,7 @@ import (
|
||||
|
||||
couchbase "github.com/couchbase/go-couchbase"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/session"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
|
||||
"github.com/bradfitz/gomemcache/memcache"
|
||||
)
|
||||
|
@ -46,7 +46,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
// import mysql driver
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
@ -56,7 +56,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
// import postgresql Driver
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
@ -39,7 +39,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
@ -33,7 +33,7 @@
|
||||
package redis_cluster
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
rediss "github.com/go-redis/redis"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -33,7 +33,7 @@
|
||||
package redis_sentinel
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
"github.com/go-redis/redis"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/session"
|
||||
)
|
||||
|
||||
func TestRedisSentinel(t *testing.T) {
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -16,7 +16,7 @@ package beego
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/astaxie/beego/testdata"
|
||||
"github.com/astaxie/beego/pkg/testdata"
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2014 beego Author. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testing
|
@ -15,8 +15,8 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/config"
|
||||
"github.com/astaxie/beego/httplib"
|
||||
"github.com/astaxie/beego/pkg/config"
|
||||
"github.com/astaxie/beego/pkg/httplib"
|
||||
)
|
||||
|
||||
var port = ""
|
||||
|
@ -19,8 +19,8 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
)
|
||||
|
||||
type testinfo struct {
|
||||
|
@ -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/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/cache"
|
||||
"github.com/astaxie/beego/pkg/context"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -17,7 +17,7 @@ package captcha
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/utils"
|
||||
"github.com/astaxie/beego/pkg/utils"
|
||||
)
|
||||
|
||||
type byteCounter struct {
|
||||
|
@ -15,7 +15,7 @@
|
||||
package pagination
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/pkg/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/astaxie/beego/pkg/utils/pagination"
|
||||
|
||||
type PostsController struct {
|
||||
beego.Controller
|
||||
|
@ -16,7 +16,7 @@ package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/astaxie/beego/pkg/logs"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
Loading…
Reference in New Issue
Block a user