Browse Source

Merge pull request #747 from flycash/updateMd

using beego v2
pull/752/head
Ming Deng 8 months ago
committed by GitHub
parent
commit
642d933c4a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 18
      cmd/commands/api/apiapp.go
  3. 2
      cmd/commands/hprose/hprose.go
  4. 4
      cmd/commands/migrate/migrate.go
  5. 10
      cmd/commands/new/new.go
  6. 2
      cmd/commands/version/version.go
  7. 6
      generate/g_appcode.go
  8. 4
      generate/g_controllers.go
  9. 8
      generate/g_hproseappcode.go
  10. 2
      generate/g_migration.go
  11. 2
      generate/g_model.go
  12. 6
      generate/swaggergen/g_docs.go
  13. 4
      go.mod
  14. 2
      utils/utils.go
  15. 2
      utils/version.go

2
README.md

@ -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() {

18
cmd/commands/api/apiapp.go

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

2
cmd/commands/hprose/hprose.go

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

4
cmd/commands/migrate/migrate.go

@ -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}}"
)

10
cmd/commands/new/new.go

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

2
cmd/commands/version/version.go

@ -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."
}

6
generate/g_appcode.go

@ -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() {

4
generate/g_controllers.go

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

8
generate/g_hproseappcode.go

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

2
generate/g_migration.go

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

2
generate/g_model.go

@ -145,7 +145,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}

6
generate/swaggergen/g_docs.go

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

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

2
utils/utils.go

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

2
utils/version.go

@ -14,4 +14,4 @@
package utils
const BEEGO_VERSION = "v1.12.4-0.20201213162117-e2a859d1564a"
const BEEGO_VERSION = "v2.0.0"

Loading…
Cancel
Save