mirror of
https://github.com/beego/bee.git
synced 2024-11-23 22:10:54 +00:00
using beego v2
This commit is contained in:
parent
9d68c302bd
commit
cdb41fad3f
@ -355,7 +355,7 @@ Breakpoint 1 set at 0x40100f for main.main() ./main.go:8
|
||||
> main.main() ./main.go:8 (hits goroutine(1):1 total:1) (PC: 0x40100f)
|
||||
3: import (
|
||||
4: _ "github.com/user/myapp/routers"
|
||||
5: beego "github.com/beego/beego/server/web"
|
||||
5: beego "github.com/beego/beego/v2/server/web"
|
||||
6: )
|
||||
7:
|
||||
=> 8: func main() {
|
||||
|
@ -76,7 +76,7 @@ var apiMaingo = `package main
|
||||
import (
|
||||
_ "{{.Appname}}/routers"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -93,8 +93,8 @@ var apiMainconngo = `package main
|
||||
import (
|
||||
_ "{{.Appname}}/routers"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
"github.com/beego/beego/client/orm"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
{{.DriverPkg}}
|
||||
)
|
||||
|
||||
@ -113,7 +113,7 @@ module %s
|
||||
|
||||
go %s
|
||||
|
||||
require github.com/beego/beego %s
|
||||
require github.com/beego/beego/v2 %s
|
||||
require github.com/smartystreets/goconvey v1.6.4
|
||||
`
|
||||
|
||||
@ -129,7 +129,7 @@ package routers
|
||||
import (
|
||||
"{{.Appname}}/controllers"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -298,7 +298,7 @@ import (
|
||||
"{{.Appname}}/models"
|
||||
"encoding/json"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// Operations about object
|
||||
@ -391,7 +391,7 @@ import (
|
||||
"{{.Appname}}/models"
|
||||
"encoding/json"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// Operations about Users
|
||||
@ -516,8 +516,8 @@ import (
|
||||
"path/filepath"
|
||||
_ "{{.Appname}}/routers"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
"github.com/beego/beego/core/logs"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
|
@ -49,7 +49,7 @@ module %s
|
||||
|
||||
go %s
|
||||
|
||||
require github.com/beego/beego %s
|
||||
require github.com/beego/beego/v2 %s
|
||||
require github.com/smartystreets/goconvey v1.6.4
|
||||
`
|
||||
|
||||
|
@ -366,8 +366,8 @@ const (
|
||||
import(
|
||||
"os"
|
||||
|
||||
"github.com/beego/beego/client/orm"
|
||||
"github.com/beego/beego/client/orm/migration"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
"github.com/beego/beego/v2/client/orm/migration"
|
||||
|
||||
_ "{{DriverRepo}}"
|
||||
)
|
||||
|
@ -70,7 +70,7 @@ var maingo = `package main
|
||||
|
||||
import (
|
||||
_ "{{.Appname}}/routers"
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -82,7 +82,7 @@ var router = `package routers
|
||||
|
||||
import (
|
||||
"{{.Appname}}/controllers"
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -93,7 +93,7 @@ var goMod = `module %s
|
||||
|
||||
go %s
|
||||
|
||||
require github.com/beego/beego %s
|
||||
require github.com/beego/beego/v2 %s
|
||||
require github.com/smartystreets/goconvey v1.6.4
|
||||
`
|
||||
var test = `package test
|
||||
@ -106,7 +106,7 @@ import (
|
||||
"path/filepath"
|
||||
_ "{{.Appname}}/routers"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
@ -140,7 +140,7 @@ func TestBeego(t *testing.T) {
|
||||
var controllers = `package controllers
|
||||
|
||||
import (
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
type MainController struct {
|
||||
|
@ -161,7 +161,7 @@ func GetBeegoVersion() string {
|
||||
}
|
||||
|
||||
}
|
||||
return "Beego is not installed. Please do consider installing it first: https://github.com/beego/beego. " +
|
||||
return "Beego is not installed. Please do consider installing it first: https://github.com/beego/beego/v2. " +
|
||||
"If you are using go mod, and you don't install the beego under $GOPATH/src/github.com/astaxie, just ignore this."
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
{{timePkg}}
|
||||
"github.com/beego/beego/client/orm"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
{{modelStruct}}
|
||||
@ -1172,7 +1172,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// {{ctrlName}}Controller operations for {{ctrlName}}
|
||||
@ -1347,7 +1347,7 @@ package routers
|
||||
import (
|
||||
"{{pkgPath}}/controllers"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -78,7 +78,7 @@ func GenerateController(cname, currpath string) {
|
||||
var controllerTpl = `package {{packageName}}
|
||||
|
||||
import (
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// {{controllerName}}Controller operations for {{controllerName}}
|
||||
@ -166,7 +166,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// {{controllerName}}Controller operations for {{controllerName}}
|
||||
|
@ -47,7 +47,7 @@ import (
|
||||
"{{.Appname}}/models"
|
||||
"github.com/hprose/hprose-golang/rpc"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
func logInvokeHandler(
|
||||
@ -90,8 +90,8 @@ import (
|
||||
"{{.Appname}}/models"
|
||||
"github.com/hprose/hprose-golang/rpc"
|
||||
|
||||
beego "github.com/beego/beego/server/web"
|
||||
"github.com/beego/beego/client/orm"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
{{.DriverPkg}}
|
||||
)
|
||||
|
||||
@ -419,7 +419,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
{{timePkg}}
|
||||
"github.com/beego/beego/client/orm"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
{{modelStruct}}
|
||||
|
@ -238,7 +238,7 @@ func GenerateMigration(mname, upsql, downsql, curpath string) {
|
||||
const (
|
||||
MigrationHeader = `package main
|
||||
import (
|
||||
"github.com/beego/beego/client/orm/migration"
|
||||
"github.com/beego/beego/v2/client/orm/migration"
|
||||
)
|
||||
|
||||
// DO NOT MODIFY
|
||||
|
@ -145,7 +145,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
{{timePkg}}
|
||||
"github.com/beego/beego/client/orm"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
{{modelStruct}}
|
||||
|
@ -35,8 +35,8 @@ import (
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/beego/beego/server/web/swagger"
|
||||
"github.com/beego/beego/core/utils"
|
||||
"github.com/beego/beego/v2/server/web/swagger"
|
||||
"github.com/beego/beego/v2/core/utils"
|
||||
beeLogger "github.com/beego/bee/logger"
|
||||
)
|
||||
|
||||
@ -429,7 +429,7 @@ func analyseControllerPkg(localName, pkgpath string) {
|
||||
if isSystemPackage(pkgpath) {
|
||||
return
|
||||
}
|
||||
if pkgpath == "github.com/beego/beego/server/web" {
|
||||
if pkgpath == "github.com/beego/beego/v2/server/web" {
|
||||
return
|
||||
}
|
||||
if localName != "" {
|
||||
|
4
go.mod
4
go.mod
@ -3,7 +3,7 @@ module github.com/beego/bee
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/beego/beego v1.12.4-0.20201213162117-e2a859d1564a
|
||||
github.com/beego/beego/v2 v2.0.0
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
@ -17,4 +17,4 @@ require (
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
)
|
||||
|
||||
//replace github.com/beego/beego => ../beego
|
||||
//replace github.com/beego/beego/v2 => ../beego
|
||||
|
@ -30,7 +30,7 @@ var DefaultBeegoPro = &Container{
|
||||
ApiPrefix: "/api",
|
||||
EnableModule: nil,
|
||||
Models: make(map[string]TextModel),
|
||||
GitRemotePath: "https://github.com/beego/beego-pro.git",
|
||||
GitRemotePath: "https://github.com/beego/beego/v2-pro.git",
|
||||
Branch: "master",
|
||||
GitLocalPath: system.BeegoHome + "/beego-pro",
|
||||
EnableFormat: true,
|
||||
|
@ -88,7 +88,7 @@ func IsInGOPATH(thePath string) bool {
|
||||
// IsBeegoProject checks whether the current path is a Beego application or not
|
||||
func IsBeegoProject(thePath string) bool {
|
||||
mainFiles := []string{}
|
||||
hasBeegoRegex := regexp.MustCompile(`(?s)package main.*?import.*?\(.*?github.com/beego/beego".*?\).*func main()`)
|
||||
hasBeegoRegex := regexp.MustCompile(`(?s)package main.*?import.*?\(.*?github.com/beego/beego/v2".*?\).*func main()`)
|
||||
c := make(chan error)
|
||||
// Walk the application path tree to look for main files.
|
||||
// Main files must satisfy the 'hasBeegoRegex' regular expression.
|
||||
|
@ -14,4 +14,4 @@
|
||||
|
||||
package utils
|
||||
|
||||
const BEEGO_VERSION = "v1.12.4-0.20201213162117-e2a859d1564a"
|
||||
const BEEGO_VERSION = "v2.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user