1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 13:00:56 +00:00

uing pkg module

This commit is contained in:
Ming Deng 2020-07-29 21:56:19 +08:00
parent 7312197732
commit aa06a10493
75 changed files with 192 additions and 181 deletions

View File

@ -54,16 +54,22 @@ import (
const ( const (
// PreSignal is the position to add filter before signal // PreSignal is the position to add filter before signal
// Deprecated: using pkg/grace, we will delete this in v2.1.0
PreSignal = iota PreSignal = iota
// PostSignal is the position to add filter after signal // PostSignal is the position to add filter after signal
// Deprecated: using pkg/grace, we will delete this in v2.1.0
PostSignal PostSignal
// StateInit represent the application inited // StateInit represent the application inited
// Deprecated: using pkg/grace, we will delete this in v2.1.0
StateInit StateInit
// StateRunning represent the application is running // StateRunning represent the application is running
// Deprecated: using pkg/grace, we will delete this in v2.1.0
StateRunning StateRunning
// StateShuttingDown represent the application is shutting down // StateShuttingDown represent the application is shutting down
// Deprecated: using pkg/grace, we will delete this in v2.1.0
StateShuttingDown StateShuttingDown
// StateTerminate represent the application is killed // StateTerminate represent the application is killed
// Deprecated: using pkg/grace, we will delete this in v2.1.0
StateTerminate StateTerminate
) )
@ -106,6 +112,7 @@ func init() {
} }
// NewServer returns a new graceServer. // 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) { func NewServer(addr string, handler http.Handler) (srv *Server) {
regLock.Lock() regLock.Lock()
defer regLock.Unlock() defer regLock.Unlock()
@ -154,12 +161,14 @@ func NewServer(addr string, handler http.Handler) (srv *Server) {
} }
// ListenAndServe refer http.ListenAndServe // ListenAndServe refer http.ListenAndServe
// Deprecated: using pkg/grace, we will delete this in v2.1.0
func ListenAndServe(addr string, handler http.Handler) error { func ListenAndServe(addr string, handler http.Handler) error {
server := NewServer(addr, handler) server := NewServer(addr, handler)
return server.ListenAndServe() return server.ListenAndServe()
} }
// ListenAndServeTLS refer http.ListenAndServeTLS // 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 { func ListenAndServeTLS(addr string, certFile string, keyFile string, handler http.Handler) error {
server := NewServer(addr, handler) server := NewServer(addr, handler)
return server.ListenAndServeTLS(certFile, keyFile) return server.ListenAndServeTLS(certFile, keyFile)

View File

@ -18,6 +18,7 @@ import (
) )
// Server embedded http.Server // Server embedded http.Server
// Deprecated: using pkg/grace, we will delete this in v2.1.0
type Server struct { type Server struct {
*http.Server *http.Server
ln net.Listener ln net.Listener
@ -32,6 +33,7 @@ type Server struct {
// Serve accepts incoming connections on the Listener l, // Serve accepts incoming connections on the Listener l,
// creating a new service goroutine for each. // creating a new service goroutine for each.
// The service goroutines read requests and then call srv.Handler to reply to them. // 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) { func (srv *Server) Serve() (err error) {
srv.state = StateRunning srv.state = StateRunning
defer func() { srv.state = StateTerminate }() 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 // 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 // to handle requests on incoming connections. If srv.Addr is blank, ":http" is
// used. // used.
// Deprecated: using pkg/grace, we will delete this in v2.1.0
func (srv *Server) ListenAndServe() (err error) { func (srv *Server) ListenAndServe() (err error) {
addr := srv.Addr addr := srv.Addr
if addr == "" { if addr == "" {
@ -94,6 +97,7 @@ func (srv *Server) ListenAndServe() (err error) {
// CA's certificate. // CA's certificate.
// //
// If srv.Addr is blank, ":https" is used. // 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) { func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
addr := srv.Addr addr := srv.Addr
if 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 // ListenAndServeMutualTLS listens on the TCP network address srv.Addr and then calls
// Serve to handle requests on incoming mutual TLS connections. // 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) { func (srv *Server) ListenAndServeMutualTLS(certFile, keyFile, trustFile string) (err error) {
addr := srv.Addr addr := srv.Addr
if 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. // 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) { func (srv *Server) RegisterSignalHook(ppFlag int, sig os.Signal, f func()) (err error) {
if ppFlag != PreSignal && ppFlag != PostSignal { if ppFlag != PreSignal && ppFlag != PostSignal {
err = fmt.Errorf("Invalid ppFlag argument. Must be either grace.PreSignal or grace.PostSignal") err = fmt.Errorf("Invalid ppFlag argument. Must be either grace.PreSignal or grace.PostSignal")

View File

@ -27,10 +27,10 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/astaxie/beego/grace" "github.com/astaxie/beego/pkg/grace"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/toolbox" "github.com/astaxie/beego/pkg/toolbox"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
// BeeAdminApp is the default adminApp used by admin module. // BeeAdminApp is the default adminApp used by admin module.

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/astaxie/beego/toolbox" "github.com/astaxie/beego/pkg/toolbox"
) )
type SampleDatabaseCheck struct { type SampleDatabaseCheck struct {

View File

@ -27,10 +27,11 @@ import (
"strings" "strings"
"time" "time"
"github.com/astaxie/beego/grace"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/utils"
"golang.org/x/crypto/acme/autocert" "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 ( var (
@ -348,7 +349,7 @@ func findAndRemoveSingleTree(entryPointTree *Tree) {
// func (b *BankAccount)Mapping(){ // func (b *BankAccount)Mapping(){
// b.Mapping("ShowAccount" , b.ShowAccount) // b.Mapping("ShowAccount" , b.ShowAccount)
// b.Mapping("ModifyAccount", b.ModifyAccount) // b.Mapping("ModifyAccount", b.ModifyAccount)
//} // }
// //
// //@router /account/:id [get] // //@router /account/:id [get]
// func (b *BankAccount) ShowAccount(){ // func (b *BankAccount) ShowAccount(){

View File

@ -35,8 +35,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/astaxie/beego/cache"
"github.com/bradfitz/gomemcache/memcache" "github.com/bradfitz/gomemcache/memcache"
"github.com/astaxie/beego/pkg/cache"
) )
// Cache Memcache adapter. // Cache Memcache adapter.

View File

@ -21,7 +21,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/astaxie/beego/cache" "github.com/astaxie/beego/pkg/cache"
) )
func TestMemcacheCache(t *testing.T) { func TestMemcacheCache(t *testing.T) {
@ -70,7 +70,7 @@ func TestMemcacheCache(t *testing.T) {
t.Error("delete err") t.Error("delete err")
} }
//test string // test string
if err = bm.Put("astaxie", "author", timeoutDuration); err != nil { if err = bm.Put("astaxie", "author", timeoutDuration); err != nil {
t.Error("set Error", err) t.Error("set Error", err)
} }
@ -82,7 +82,7 @@ func TestMemcacheCache(t *testing.T) {
t.Error("get err") t.Error("get err")
} }
//test GetMulti // test GetMulti
if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil { if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil {
t.Error("set Error", err) t.Error("set Error", err)
} }

View File

@ -34,12 +34,12 @@ import (
"errors" "errors"
"fmt" "fmt"
"strconv" "strconv"
"strings"
"time" "time"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/astaxie/beego/cache" "github.com/astaxie/beego/pkg/cache"
"strings"
) )
var ( var (
@ -56,7 +56,7 @@ type Cache struct {
password string password string
maxIdle int maxIdle int
//the timeout to a value less than the redis server's timeout. // the timeout to a value less than the redis server's timeout.
timeout time.Duration timeout time.Duration
} }

View File

@ -19,9 +19,10 @@ import (
"testing" "testing"
"time" "time"
"github.com/astaxie/beego/cache"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/astaxie/beego/pkg/cache"
) )
func TestRedisCache(t *testing.T) { func TestRedisCache(t *testing.T) {
@ -70,7 +71,7 @@ func TestRedisCache(t *testing.T) {
t.Error("delete err") t.Error("delete err")
} }
//test string // test string
if err = bm.Put("astaxie", "author", timeoutDuration); err != nil { if err = bm.Put("astaxie", "author", timeoutDuration); err != nil {
t.Error("set Error", err) t.Error("set Error", err)
} }
@ -82,7 +83,7 @@ func TestRedisCache(t *testing.T) {
t.Error("get err") t.Error("get err")
} }
//test GetMulti // test GetMulti
if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil { if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil {
t.Error("set Error", err) t.Error("set Error", err)
} }

View File

@ -9,7 +9,7 @@ import (
"github.com/ssdb/gossdb/ssdb" "github.com/ssdb/gossdb/ssdb"
"github.com/astaxie/beego/cache" "github.com/astaxie/beego/pkg/cache"
) )
// Cache SSDB adapter // Cache SSDB adapter

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/astaxie/beego/cache" "github.com/astaxie/beego/pkg/cache"
) )
func TestSsdbcacheCache(t *testing.T) { func TestSsdbcacheCache(t *testing.T) {

View File

@ -22,11 +22,11 @@ import (
"runtime" "runtime"
"strings" "strings"
"github.com/astaxie/beego/config" "github.com/astaxie/beego/pkg/config"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
// Config is the main struct for BConfig // Config is the main struct for BConfig

View File

@ -21,7 +21,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
var env *utils.BeeMap var env *utils.BeeMap

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package config package ini
import ( import (
"bufio" "bufio"
@ -26,6 +26,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/pkg/config"
) )
var ( var (
@ -45,7 +47,7 @@ type IniConfig struct {
} }
// Parse creates a new Config and parses the file configuration from the named file. // 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) return ini.parseFile(name)
} }
@ -195,7 +197,7 @@ func (ini *IniConfig) parseData(dir string, data []byte) (*IniConfigContainer, e
val = bytes.Trim(val, `"`) val = bytes.Trim(val, `"`)
} }
cfg.data[section][key] = ExpandValueEnv(string(val)) cfg.data[section][key] = config.ExpandValueEnv(string(val))
if comment.Len() > 0 { if comment.Len() > 0 {
cfg.keyComment[section+"."+key] = comment.String() cfg.keyComment[section+"."+key] = comment.String()
comment.Reset() comment.Reset()
@ -208,7 +210,7 @@ func (ini *IniConfig) parseData(dir string, data []byte) (*IniConfigContainer, e
// ParseData parse ini the data // ParseData parse ini the data
// When include other.conf,other.conf is either absolute directory // When include other.conf,other.conf is either absolute directory
// or under beego in default temporary directory(/tmp/beego[-username]). // 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" dir := "beego"
currentUser, err := user.Current() currentUser, err := user.Current()
if err == nil { if err == nil {
@ -233,7 +235,7 @@ type IniConfigContainer struct {
// Bool returns the boolean value for a given key. // Bool returns the boolean value for a given key.
func (c *IniConfigContainer) Bool(key string) (bool, error) { 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. // DefaultBool returns the boolean value for a given key.
@ -500,5 +502,5 @@ func (c *IniConfigContainer) getdata(key string) string {
} }
func init() { func init() {
Register("ini", &IniConfig{}) config.Register("ini", &IniConfig{})
} }

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package config package ini
import ( import (
"fmt" "fmt"
@ -20,6 +20,8 @@ import (
"os" "os"
"strings" "strings"
"testing" "testing"
"github.com/astaxie/beego/pkg/config"
) )
func TestIni(t *testing.T) { func TestIni(t *testing.T) {
@ -92,7 +94,7 @@ password = ${GOPATH}
} }
f.Close() f.Close()
defer os.Remove("testini.conf") defer os.Remove("testini.conf")
iniconf, err := NewConfig("ini", "testini.conf") iniconf, err := config.NewConfig("ini", "testini.conf")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -165,7 +167,7 @@ httpport=8080
name=mysql name=mysql
` `
) )
cfg, err := NewConfigData("ini", []byte(inicontext)) cfg, err := config.NewConfigData("ini", []byte(inicontext))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package config package json
import ( import (
"encoding/json" "encoding/json"
@ -23,6 +23,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/pkg/config"
) )
// JSONConfig is a json config parser and implements Config interface. // 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. // 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) file, err := os.Open(filename)
if err != nil { if err != nil {
return nil, err return nil, err
@ -45,7 +47,7 @@ func (js *JSONConfig) Parse(filename string) (Configer, error) {
} }
// ParseData returns a ConfigContainer with json string // 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{ x := &JSONConfigContainer{
data: make(map[string]interface{}), data: make(map[string]interface{}),
} }
@ -59,7 +61,7 @@ func (js *JSONConfig) ParseData(data []byte) (Configer, error) {
x.data["rootArray"] = wrappingArray x.data["rootArray"] = wrappingArray
} }
x.data = ExpandValueEnvForMap(x.data) x.data = config.ExpandValueEnvForMap(x.data)
return x, nil return x, nil
} }
@ -75,7 +77,7 @@ type JSONConfigContainer struct {
func (c *JSONConfigContainer) Bool(key string) (bool, error) { func (c *JSONConfigContainer) Bool(key string) (bool, error) {
val := c.getData(key) val := c.getData(key)
if val != nil { if val != nil {
return ParseBool(val) return config.ParseBool(val)
} }
return false, fmt.Errorf("not exist key: %q", key) return false, fmt.Errorf("not exist key: %q", key)
} }
@ -265,5 +267,5 @@ func (c *JSONConfigContainer) getData(key string) interface{} {
} }
func init() { func init() {
Register("json", &JSONConfig{}) config.Register("json", &JSONConfig{})
} }

View File

@ -12,12 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package config package json
import ( import (
"fmt" "fmt"
"os" "os"
"testing" "testing"
"github.com/astaxie/beego/pkg/config"
) )
func TestJsonStartsWithArray(t *testing.T) { func TestJsonStartsWithArray(t *testing.T) {
@ -43,7 +45,7 @@ func TestJsonStartsWithArray(t *testing.T) {
} }
f.Close() f.Close()
defer os.Remove("testjsonWithArray.conf") defer os.Remove("testjsonWithArray.conf")
jsonconf, err := NewConfig("json", "testjsonWithArray.conf") jsonconf, err := config.NewConfig("json", "testjsonWithArray.conf")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -143,7 +145,7 @@ func TestJson(t *testing.T) {
} }
f.Close() f.Close()
defer os.Remove("testjson.conf") defer os.Remove("testjson.conf")
jsonconf, err := NewConfig("json", "testjson.conf") jsonconf, err := config.NewConfig("json", "testjson.conf")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -39,7 +39,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/config" "github.com/astaxie/beego/pkg/config"
"github.com/beego/x2j" "github.com/beego/x2j"
) )

View File

@ -19,7 +19,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/astaxie/beego/config" "github.com/astaxie/beego/pkg/config"
) )
func TestXML(t *testing.T) { func TestXML(t *testing.T) {

View File

@ -40,7 +40,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/config" "github.com/astaxie/beego/pkg/config"
"github.com/beego/goyaml2" "github.com/beego/goyaml2"
) )

View File

@ -19,7 +19,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/astaxie/beego/config" "github.com/astaxie/beego/pkg/config"
) )
func TestYaml(t *testing.T) { func TestYaml(t *testing.T) {

View File

@ -19,7 +19,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/astaxie/beego/config" beeJson "github.com/astaxie/beego/pkg/config/json"
) )
func TestDefaults(t *testing.T) { func TestDefaults(t *testing.T) {
@ -35,7 +35,7 @@ func TestDefaults(t *testing.T) {
func TestAssignConfig_01(t *testing.T) { func TestAssignConfig_01(t *testing.T) {
_BConfig := &Config{} _BConfig := &Config{}
_BConfig.AppName = "beego_test" _BConfig.AppName = "beego_test"
jcf := &config.JSONConfig{} jcf := &beeJson.JSONConfig{}
ac, _ := jcf.ParseData([]byte(`{"AppName":"beego_json"}`)) ac, _ := jcf.ParseData([]byte(`{"AppName":"beego_json"}`))
assignSingleConfig(_BConfig, ac) assignSingleConfig(_BConfig, ac)
if _BConfig.AppName != "beego_json" { if _BConfig.AppName != "beego_json" {
@ -73,7 +73,7 @@ func TestAssignConfig_02(t *testing.T) {
configMap["SessionProviderConfig"] = "file" configMap["SessionProviderConfig"] = "file"
configMap["FileLineNum"] = true configMap["FileLineNum"] = true
jcf := &config.JSONConfig{} jcf := &beeJson.JSONConfig{}
bs, _ = json.Marshal(configMap) bs, _ = json.Marshal(configMap)
ac, _ := jcf.ParseData(bs) ac, _ := jcf.ParseData(bs)
@ -109,7 +109,7 @@ func TestAssignConfig_02(t *testing.T) {
} }
func TestAssignConfig_03(t *testing.T) { func TestAssignConfig_03(t *testing.T) {
jcf := &config.JSONConfig{} jcf := &beeJson.JSONConfig{}
ac, _ := jcf.ParseData([]byte(`{"AppName":"beego"}`)) ac, _ := jcf.ParseData([]byte(`{"AppName":"beego"}`))
ac.Set("AppName", "test_app") ac.Set("AppName", "test_app")
ac.Set("RunMode", "online") ac.Set("RunMode", "online")

View File

@ -35,7 +35,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
//commonly used mime-types //commonly used mime-types

View File

@ -29,7 +29,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
) )
// Regexes for checking the accept headers // Regexes for checking the accept headers

View File

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"reflect" "reflect"
beecontext "github.com/astaxie/beego/context" beecontext "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
// ConvertParams converts http method params to values that will be passed to the method controller as arguments // ConvertParams converts http method params to values that will be passed to the method controller as arguments

View File

@ -28,9 +28,9 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/context/param" "github.com/astaxie/beego/pkg/context/param"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
) )
var ( var (

View File

@ -19,7 +19,7 @@ import (
"strconv" "strconv"
"testing" "testing"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"os" "os"
"path/filepath" "path/filepath"
) )

View File

@ -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. 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 package main
import "github.com/astaxie/beego" import "github.com/astaxie/beego/pkg"
func main() { func main() {
beego.Run() beego.Run()

View File

@ -23,8 +23,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
const ( const (

View File

@ -14,7 +14,7 @@
package beego 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. // FilterFunc defines a filter function which is invoked before the controller handler is executed.
type FilterFunc func(*context.Context) type FilterFunc func(*context.Context)

View File

@ -19,7 +19,7 @@ import (
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
var FilterUser = func(ctx *context.Context) { var FilterUser = func(ctx *context.Context) {

View File

@ -6,9 +6,9 @@ import (
"net/http" "net/http"
"path/filepath" "path/filepath"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
) )
// register MIME type with content type // register MIME type with content type

View File

@ -17,11 +17,11 @@ package beego
import ( import (
"strings" "strings"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
// Log levels to control the logging output. // 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 ( const (
LevelEmergency = iota LevelEmergency = iota
LevelAlert LevelAlert
@ -34,90 +34,90 @@ const (
) )
// BeeLogger references the used application logger. // 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() var BeeLogger = logs.GetBeeLogger()
// SetLevel sets the global log level used by the simple logger. // 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) { func SetLevel(l int) {
logs.SetLevel(l) logs.SetLevel(l)
} }
// SetLogFuncCall set the CallDepth, default is 3 // 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) { func SetLogFuncCall(b bool) {
logs.SetLogFuncCall(b) logs.SetLogFuncCall(b)
} }
// SetLogger sets a new logger. // 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 { func SetLogger(adaptername string, config string) error {
return logs.SetLogger(adaptername, config) return logs.SetLogger(adaptername, config)
} }
// Emergency logs a message at emergency level. // 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{}) { func Emergency(v ...interface{}) {
logs.Emergency(generateFmtStr(len(v)), v...) logs.Emergency(generateFmtStr(len(v)), v...)
} }
// Alert logs a message at alert level. // 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{}) { func Alert(v ...interface{}) {
logs.Alert(generateFmtStr(len(v)), v...) logs.Alert(generateFmtStr(len(v)), v...)
} }
// Critical logs a message at critical level. // 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{}) { func Critical(v ...interface{}) {
logs.Critical(generateFmtStr(len(v)), v...) logs.Critical(generateFmtStr(len(v)), v...)
} }
// Error logs a message at error level. // 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{}) { func Error(v ...interface{}) {
logs.Error(generateFmtStr(len(v)), v...) logs.Error(generateFmtStr(len(v)), v...)
} }
// Warning logs a message at warning level. // 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{}) { func Warning(v ...interface{}) {
logs.Warning(generateFmtStr(len(v)), v...) logs.Warning(generateFmtStr(len(v)), v...)
} }
// Warn compatibility alias for Warning() // 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{}) { func Warn(v ...interface{}) {
logs.Warn(generateFmtStr(len(v)), v...) logs.Warn(generateFmtStr(len(v)), v...)
} }
// Notice logs a message at notice level. // 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{}) { func Notice(v ...interface{}) {
logs.Notice(generateFmtStr(len(v)), v...) logs.Notice(generateFmtStr(len(v)), v...)
} }
// Informational logs a message at info level. // 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{}) { func Informational(v ...interface{}) {
logs.Informational(generateFmtStr(len(v)), v...) logs.Informational(generateFmtStr(len(v)), v...)
} }
// Info compatibility alias for Warning() // 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{}) { func Info(v ...interface{}) {
logs.Info(generateFmtStr(len(v)), v...) logs.Info(generateFmtStr(len(v)), v...)
} }
// Debug logs a message at debug level. // 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{}) { func Debug(v ...interface{}) {
logs.Debug(generateFmtStr(len(v)), v...) logs.Debug(generateFmtStr(len(v)), v...)
} }
// Trace logs a message at trace level. // Trace logs a message at trace level.
// compatibility alias for Warning() // 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{}) { func Trace(v ...interface{}) {
logs.Trace(generateFmtStr(len(v)), v...) logs.Trace(generateFmtStr(len(v)), v...)
} }

View File

@ -6,7 +6,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
) )

View File

@ -12,7 +12,7 @@ import (
"github.com/elastic/go-elasticsearch/v6" "github.com/elastic/go-elasticsearch/v6"
"github.com/elastic/go-elasticsearch/v6/esapi" "github.com/elastic/go-elasticsearch/v6/esapi"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
// NewES return a LoggerInterface // NewES return a LoggerInterface

View File

@ -23,8 +23,8 @@ import (
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
func PrometheusMiddleWare(next http.Handler) http.Handler { func PrometheusMiddleWare(next http.Handler) http.Handler {

View File

@ -22,7 +22,7 @@ import (
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
func TestPrometheusMiddleWare(t *testing.T) { func TestPrometheusMiddleWare(t *testing.T) {

View File

@ -17,7 +17,7 @@ package migration
import ( import (
"fmt" "fmt"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
// Index struct defines the structure of Index Columns // Index struct defines the structure of Index Columns

View File

@ -33,8 +33,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/orm" "github.com/astaxie/beego/pkg/orm"
) )
// const the data format for the bee generate migration datatype // const the data format for the bee generate migration datatype

View File

@ -18,7 +18,7 @@ import (
"net/http" "net/http"
"strings" "strings"
beecontext "github.com/astaxie/beego/context" beecontext "github.com/astaxie/beego/pkg/context"
) )
type namespaceCond func(*beecontext.Context) bool type namespaceCond func(*beecontext.Context) bool
@ -97,91 +97,91 @@ func (n *Namespace) Filter(action string, filter ...FilterFunc) *Namespace {
} }
// Router same as beego.Rourer // 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 { func (n *Namespace) Router(rootpath string, c ControllerInterface, mappingMethods ...string) *Namespace {
n.handlers.Add(rootpath, c, mappingMethods...) n.handlers.Add(rootpath, c, mappingMethods...)
return n return n
} }
// AutoRouter same as beego.AutoRouter // 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 { func (n *Namespace) AutoRouter(c ControllerInterface) *Namespace {
n.handlers.AddAuto(c) n.handlers.AddAuto(c)
return n return n
} }
// AutoPrefix same as beego.AutoPrefix // 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 { func (n *Namespace) AutoPrefix(prefix string, c ControllerInterface) *Namespace {
n.handlers.AddAutoPrefix(prefix, c) n.handlers.AddAutoPrefix(prefix, c)
return n return n
} }
// Get same as beego.Get // 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 { func (n *Namespace) Get(rootpath string, f FilterFunc) *Namespace {
n.handlers.Get(rootpath, f) n.handlers.Get(rootpath, f)
return n return n
} }
// Post same as beego.Post // 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 { func (n *Namespace) Post(rootpath string, f FilterFunc) *Namespace {
n.handlers.Post(rootpath, f) n.handlers.Post(rootpath, f)
return n return n
} }
// Delete same as beego.Delete // 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 { func (n *Namespace) Delete(rootpath string, f FilterFunc) *Namespace {
n.handlers.Delete(rootpath, f) n.handlers.Delete(rootpath, f)
return n return n
} }
// Put same as beego.Put // 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 { func (n *Namespace) Put(rootpath string, f FilterFunc) *Namespace {
n.handlers.Put(rootpath, f) n.handlers.Put(rootpath, f)
return n return n
} }
// Head same as beego.Head // 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 { func (n *Namespace) Head(rootpath string, f FilterFunc) *Namespace {
n.handlers.Head(rootpath, f) n.handlers.Head(rootpath, f)
return n return n
} }
// Options same as beego.Options // 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 { func (n *Namespace) Options(rootpath string, f FilterFunc) *Namespace {
n.handlers.Options(rootpath, f) n.handlers.Options(rootpath, f)
return n return n
} }
// Patch same as beego.Patch // 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 { func (n *Namespace) Patch(rootpath string, f FilterFunc) *Namespace {
n.handlers.Patch(rootpath, f) n.handlers.Patch(rootpath, f)
return n return n
} }
// Any same as beego.Any // 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 { func (n *Namespace) Any(rootpath string, f FilterFunc) *Namespace {
n.handlers.Any(rootpath, f) n.handlers.Any(rootpath, f)
return n return n
} }
// Handler same as beego.Handler // 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 { func (n *Namespace) Handler(rootpath string, h http.Handler) *Namespace {
n.handlers.Handler(rootpath, h) n.handlers.Handler(rootpath, h)
return n return n
} }
// Include add include class // 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 { func (n *Namespace) Include(cList ...ControllerInterface) *Namespace {
n.handlers.Include(cList...) n.handlers.Include(cList...)
return n return n

View File

@ -20,7 +20,7 @@ import (
"strconv" "strconv"
"testing" "testing"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
func TestNamespaceGet(t *testing.T) { func TestNamespaceGet(t *testing.T) {

View File

@ -63,7 +63,7 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
// DebugQueries define the debug // DebugQueries define the debug

View File

@ -30,16 +30,16 @@ import (
"strings" "strings"
"unicode" "unicode"
"github.com/astaxie/beego/context/param" "github.com/astaxie/beego/pkg/context/param"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
var globalRouterTemplate = `package {{.routersDir}} var globalRouterTemplate = `package {{.routersDir}}
import ( import (
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context/param"{{.globalimport}} "github.com/astaxie/beego/pkg/context/param"{{.globalimport}}
) )
func init() { func init() {

View File

@ -65,8 +65,8 @@ import (
"sort" "sort"
"time" "time"
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
// AppIDToAppSecret is used to get appsecret throw appid // AppIDToAppSecret is used to get appsecret throw appid

View File

@ -40,8 +40,8 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
var defaultRealm = "Authorization Required" var defaultRealm = "Authorization Required"

View File

@ -40,8 +40,8 @@
package authz package authz
import ( import (
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/casbin/casbin" "github.com/casbin/casbin"
"net/http" "net/http"
) )

View File

@ -15,9 +15,9 @@
package authz package authz
import ( import (
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/plugins/auth" "github.com/astaxie/beego/pkg/plugins/auth"
"github.com/casbin/casbin" "github.com/casbin/casbin"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"

View File

@ -42,8 +42,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
const ( const (

View File

@ -21,8 +21,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
// HTTPHeaderGuardRecorder is httptest.ResponseRecorder with own http.Header // HTTPHeaderGuardRecorder is httptest.ResponseRecorder with own http.Header

View File

@ -17,7 +17,7 @@ package beego
import ( import (
"strings" "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. // PolicyFunc defines a policy function which is invoked before the controller handler is executed.

View File

@ -27,11 +27,11 @@ import (
"sync" "sync"
"time" "time"
beecontext "github.com/astaxie/beego/context" beecontext "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/context/param" "github.com/astaxie/beego/pkg/context/param"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/toolbox" "github.com/astaxie/beego/pkg/toolbox"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
// default filter execution points // default filter execution points

View File

@ -21,8 +21,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
) )
type TestController struct { type TestController struct {

View File

@ -39,7 +39,7 @@ import (
couchbase "github.com/couchbase/go-couchbase" couchbase "github.com/couchbase/go-couchbase"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
) )
var couchbpder = &Provider{} var couchbpder = &Provider{}

View File

@ -10,7 +10,7 @@ import (
"github.com/ledisdb/ledisdb/config" "github.com/ledisdb/ledisdb/config"
"github.com/ledisdb/ledisdb/ledis" "github.com/ledisdb/ledisdb/ledis"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
) )
var ( var (

View File

@ -37,7 +37,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
"github.com/bradfitz/gomemcache/memcache" "github.com/bradfitz/gomemcache/memcache"
) )

View File

@ -46,7 +46,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
// import mysql driver // import mysql driver
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )

View File

@ -56,7 +56,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
// import postgresql Driver // import postgresql Driver
_ "github.com/lib/pq" _ "github.com/lib/pq"
) )

View File

@ -39,7 +39,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
) )

View File

@ -33,7 +33,7 @@
package redis_cluster package redis_cluster
import ( import (
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
rediss "github.com/go-redis/redis" rediss "github.com/go-redis/redis"
"net/http" "net/http"
"strconv" "strconv"

View File

@ -33,7 +33,7 @@
package redis_sentinel package redis_sentinel
import ( import (
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
"github.com/go-redis/redis" "github.com/go-redis/redis"
"net/http" "net/http"
"strconv" "strconv"

View File

@ -5,7 +5,7 @@ import (
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
) )
func TestRedisSentinel(t *testing.T) { func TestRedisSentinel(t *testing.T) {

View File

@ -29,7 +29,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
func init() { func init() {

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/session" "github.com/astaxie/beego/pkg/session"
"github.com/ssdb/gossdb/ssdb" "github.com/ssdb/gossdb/ssdb"
) )

View File

@ -26,8 +26,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/hashicorp/golang-lru" "github.com/hashicorp/golang-lru"
) )

View File

@ -27,8 +27,8 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
var ( var (

View File

@ -16,7 +16,7 @@ package beego
import ( import (
"bytes" "bytes"
"github.com/astaxie/beego/testdata" "github.com/astaxie/beego/pkg/testdata"
"github.com/elazarl/go-bindata-assetfs" "github.com/elazarl/go-bindata-assetfs"
"net/http" "net/http"
"os" "os"

View File

@ -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

View File

@ -15,8 +15,8 @@
package testing package testing
import ( import (
"github.com/astaxie/beego/config" "github.com/astaxie/beego/pkg/config"
"github.com/astaxie/beego/httplib" "github.com/astaxie/beego/pkg/httplib"
) )
var port = "" var port = ""

View File

@ -19,8 +19,8 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
var ( var (

View File

@ -18,7 +18,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
type testinfo struct { type testinfo struct {

View File

@ -66,11 +66,11 @@ import (
"strings" "strings"
"time" "time"
"github.com/astaxie/beego" "github.com/astaxie/beego/pkg"
"github.com/astaxie/beego/cache" "github.com/astaxie/beego/pkg/cache"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
var ( var (

View File

@ -17,7 +17,7 @@ package captcha
import ( import (
"testing" "testing"
"github.com/astaxie/beego/utils" "github.com/astaxie/beego/pkg/utils"
) )
type byteCounter struct { type byteCounter struct {

View File

@ -15,7 +15,7 @@
package pagination package pagination
import ( import (
"github.com/astaxie/beego/context" "github.com/astaxie/beego/pkg/context"
) )
// SetPaginator Instantiates a Paginator and assigns it to context.Input.Data("paginator"). // SetPaginator Instantiates a Paginator and assigns it to context.Input.Data("paginator").

View File

@ -8,7 +8,7 @@ In your beego.Controller:
package controllers package controllers
import "github.com/astaxie/beego/utils/pagination" import "github.com/astaxie/beego/pkg/utils/pagination"
type PostsController struct { type PostsController struct {
beego.Controller beego.Controller

View File

@ -16,7 +16,7 @@ package validation
import ( import (
"fmt" "fmt"
"github.com/astaxie/beego/logs" "github.com/astaxie/beego/pkg/logs"
"reflect" "reflect"
"regexp" "regexp"
"strings" "strings"