🎨 清理多余文件,修改项目model
This commit is contained in:
@@ -2,7 +2,7 @@ package ast
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/model/system"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// AddRegisterTablesAst 自动为 gorm.go 注册一个自动迁移
|
||||
func AddRegisterTablesAst(path, funcName, pk, varName, dbName, model string) {
|
||||
modelPk := fmt.Sprintf("github.com/flipped-aurora/gin-vue-admin/server/model/%s", pk)
|
||||
modelPk := fmt.Sprintf("git.echol.cn/loser/Go-Web-Template/server/model/%s", pk)
|
||||
src, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ func RollGormBack(pk, model string) {
|
||||
if gen, ok := node.(*ast.GenDecl); ok {
|
||||
for i := range gen.Specs {
|
||||
if imspec, ok := gen.Specs[i].(*ast.ImportSpec); ok {
|
||||
if imspec.Path.Value == "\"github.com/flipped-aurora/gin-vue-admin/server/model/"+pk+"\"" {
|
||||
if imspec.Path.Value == "\"git.echol.cn/loser/Go-Web-Template/server/model/"+pk+"\"" {
|
||||
gp = gen
|
||||
imI = i
|
||||
return false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/printer"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -25,7 +25,7 @@ func TestPackageEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageApiEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "api", "v1", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/api/v1/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/api/v1/example"`,
|
||||
StructName: "ExampleApiGroup",
|
||||
PackageName: "example",
|
||||
PackageStructName: "ApiGroup",
|
||||
@@ -37,7 +37,7 @@ func TestPackageEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageRouterEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "router", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/router/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/router/example"`,
|
||||
StructName: "Example",
|
||||
PackageName: "example",
|
||||
PackageStructName: "RouterGroup",
|
||||
@@ -49,7 +49,7 @@ func TestPackageEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageServiceEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "service", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/service/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/service/example"`,
|
||||
StructName: "ExampleServiceGroup",
|
||||
PackageName: "example",
|
||||
PackageStructName: "ServiceGroup",
|
||||
@@ -99,7 +99,7 @@ func TestPackageEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageApiEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "api", "v1", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/api/v1/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/api/v1/example"`,
|
||||
StructName: "ExampleApiGroup",
|
||||
PackageName: "example",
|
||||
PackageStructName: "ApiGroup",
|
||||
@@ -110,7 +110,7 @@ func TestPackageEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageRouterEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "router", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/router/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/router/example"`,
|
||||
StructName: "Example",
|
||||
PackageName: "example",
|
||||
PackageStructName: "RouterGroup",
|
||||
@@ -122,7 +122,7 @@ func TestPackageEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageServiceEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "service", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/service/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/service/example"`,
|
||||
StructName: "ExampleServiceGroup",
|
||||
PackageName: "example",
|
||||
PackageStructName: "ServiceGroup",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -25,7 +25,7 @@ func TestPackageInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaFileUploadAndDownload",
|
||||
PackageName: "example",
|
||||
IsNew: false,
|
||||
@@ -36,7 +36,7 @@ func TestPackageInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaCustomer",
|
||||
PackageName: "example",
|
||||
IsNew: false,
|
||||
@@ -47,7 +47,7 @@ func TestPackageInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaFileUploadAndDownload",
|
||||
PackageName: "example",
|
||||
IsNew: true,
|
||||
@@ -58,7 +58,7 @@ func TestPackageInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaCustomer",
|
||||
PackageName: "example",
|
||||
IsNew: true,
|
||||
@@ -107,7 +107,7 @@ func TestPackageInitializeGorm_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaFileUploadAndDownload",
|
||||
PackageName: "example",
|
||||
IsNew: false,
|
||||
@@ -118,7 +118,7 @@ func TestPackageInitializeGorm_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaCustomer",
|
||||
PackageName: "example",
|
||||
IsNew: false,
|
||||
@@ -129,7 +129,7 @@ func TestPackageInitializeGorm_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaFileUploadAndDownload",
|
||||
PackageName: "example",
|
||||
IsNew: true,
|
||||
@@ -140,7 +140,7 @@ func TestPackageInitializeGorm_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "gorm_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/model/example"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/model/example"`,
|
||||
StructName: "ExaCustomer",
|
||||
PackageName: "example",
|
||||
IsNew: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -28,7 +28,7 @@ func TestPackageInitializeRouter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "router_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/router"`,
|
||||
AppName: "RouterGroupApp",
|
||||
GroupName: "Example",
|
||||
ModuleName: "exampleRouter",
|
||||
@@ -43,7 +43,7 @@ func TestPackageInitializeRouter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "router_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/router"`,
|
||||
AppName: "RouterGroupApp",
|
||||
GroupName: "Example",
|
||||
ModuleName: "exampleRouter",
|
||||
@@ -105,7 +105,7 @@ func TestPackageInitializeRouter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "router_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/router"`,
|
||||
AppName: "RouterGroupApp",
|
||||
GroupName: "Example",
|
||||
ModuleName: "exampleRouter",
|
||||
@@ -120,7 +120,7 @@ func TestPackageInitializeRouter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "initialize", "router_biz.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/router"`,
|
||||
AppName: "RouterGroupApp",
|
||||
GroupName: "Example",
|
||||
ModuleName: "exampleRouter",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -28,7 +28,7 @@ func TestPackageModuleEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageRouterModuleEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "router", "example", "enter.go"),
|
||||
ImportPath: `api "github.com/flipped-aurora/gin-vue-admin/server/api/v1"`,
|
||||
ImportPath: `api "git.echol.cn/loser/Go-Web-Template/server/api/v1"`,
|
||||
StructName: "FileUploadAndDownloadRouter",
|
||||
AppName: "ApiGroupApp",
|
||||
GroupName: "ExampleApiGroup",
|
||||
@@ -43,7 +43,7 @@ func TestPackageModuleEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageApiModuleEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "api", "v1", "example", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/service"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/service"`,
|
||||
StructName: "FileUploadAndDownloadApi",
|
||||
AppName: "ServiceGroupApp",
|
||||
GroupName: "ExampleServiceGroup",
|
||||
@@ -117,7 +117,7 @@ func TestPackageModuleEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageRouterModuleEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "router", "example", "enter.go"),
|
||||
ImportPath: `api "github.com/flipped-aurora/gin-vue-admin/server/api/v1"`,
|
||||
ImportPath: `api "git.echol.cn/loser/Go-Web-Template/server/api/v1"`,
|
||||
StructName: "FileUploadAndDownloadRouter",
|
||||
AppName: "ApiGroupApp",
|
||||
GroupName: "ExampleApiGroup",
|
||||
@@ -132,7 +132,7 @@ func TestPackageModuleEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePackageApiModuleEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "api", "v1", "example", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/service"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/service"`,
|
||||
StructName: "FileUploadAndDownloadApi",
|
||||
AppName: "ServiceGroupApp",
|
||||
GroupName: "ExampleServiceGroup",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//go:build legacy_plugin_ast
|
||||
// +build legacy_plugin_ast
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -28,7 +31,7 @@ func TestPluginEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginApiEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "api", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/service"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/service"`,
|
||||
StructName: "User",
|
||||
StructCamelName: "user",
|
||||
ModuleName: "serviceUser",
|
||||
@@ -43,7 +46,7 @@ func TestPluginEnter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginRouterEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "router", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/api"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/api"`,
|
||||
StructName: "User",
|
||||
StructCamelName: "user",
|
||||
ModuleName: "userApi",
|
||||
@@ -132,7 +135,7 @@ func TestPluginEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginRouterEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "router", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/api"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/api"`,
|
||||
StructName: "User",
|
||||
StructCamelName: "user",
|
||||
ModuleName: "userApi",
|
||||
@@ -147,7 +150,7 @@ func TestPluginEnter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginApiEnter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "api", "enter.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/service"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/service"`,
|
||||
StructName: "User",
|
||||
StructCamelName: "user",
|
||||
ModuleName: "serviceUser",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//go:build legacy_plugin_ast
|
||||
// +build legacy_plugin_ast
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -25,7 +28,7 @@ func TestPluginGenModel_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginGen,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "gen", "main.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
PackageName: "model",
|
||||
StructName: "User",
|
||||
IsNew: false,
|
||||
@@ -36,7 +39,7 @@ func TestPluginGenModel_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginGen,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "gen", "main.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
PackageName: "model",
|
||||
StructName: "User",
|
||||
IsNew: true,
|
||||
@@ -85,7 +88,7 @@ func TestPluginGenModel_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginGen,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "gen", "main.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
PackageName: "model",
|
||||
StructName: "User",
|
||||
IsNew: false,
|
||||
@@ -96,7 +99,7 @@ func TestPluginGenModel_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginGen,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "gen", "main.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
PackageName: "model",
|
||||
StructName: "User",
|
||||
IsNew: true,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//go:build legacy_plugin_ast
|
||||
// +build legacy_plugin_ast
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -25,7 +28,7 @@ func TestPluginInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "gorm.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
StructName: "User",
|
||||
PackageName: "model",
|
||||
IsNew: false,
|
||||
@@ -36,7 +39,7 @@ func TestPluginInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "gorm.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
StructName: "User",
|
||||
PackageName: "model",
|
||||
IsNew: true,
|
||||
@@ -47,7 +50,7 @@ func TestPluginInitializeGorm_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "gorm.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
StructName: "SysUser",
|
||||
PackageName: "model",
|
||||
IsNew: true,
|
||||
@@ -96,7 +99,7 @@ func TestPluginInitializeGorm_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "gorm.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
StructName: "User",
|
||||
PackageName: "model",
|
||||
IsNew: false,
|
||||
@@ -107,7 +110,7 @@ func TestPluginInitializeGorm_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeGorm,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "gorm.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/model"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/model"`,
|
||||
StructName: "User",
|
||||
PackageName: "model",
|
||||
IsNew: true,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//go:build legacy_plugin_ast
|
||||
// +build legacy_plugin_ast
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -28,7 +31,7 @@ func TestPluginInitializeRouter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "router.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/router"`,
|
||||
AppName: "Router",
|
||||
GroupName: "User",
|
||||
PackageName: "router",
|
||||
@@ -43,7 +46,7 @@ func TestPluginInitializeRouter_Injection(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "router.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/router"`,
|
||||
AppName: "Router",
|
||||
GroupName: "U中文",
|
||||
PackageName: "router",
|
||||
@@ -102,7 +105,7 @@ func TestPluginInitializeRouter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "router.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/router"`,
|
||||
AppName: "Router",
|
||||
GroupName: "User",
|
||||
PackageName: "router",
|
||||
@@ -117,7 +120,7 @@ func TestPluginInitializeRouter_Rollback(t *testing.T) {
|
||||
fields: fields{
|
||||
Type: TypePluginInitializeRouter,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "initialize", "router.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva/router"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva/router"`,
|
||||
AppName: "Router",
|
||||
GroupName: "U中文",
|
||||
PackageName: "router",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//go:build legacy_plugin_ast
|
||||
// +build legacy_plugin_ast
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -24,7 +27,7 @@ func TestPluginInitialize_Injection(t *testing.T) {
|
||||
Type: TypePluginInitializeV2,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "plugin.go"),
|
||||
PluginPath: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "register.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva"`,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
@@ -71,7 +74,7 @@ func TestPluginInitialize_Rollback(t *testing.T) {
|
||||
Type: TypePluginInitializeV2,
|
||||
Path: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "plugin.go"),
|
||||
PluginPath: filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "register.go"),
|
||||
ImportPath: `"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva"`,
|
||||
ImportPath: `"git.echol.cn/loser/Go-Web-Template/server/plugin/gva"`,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package utils
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/casbin/casbin/v2/model"
|
||||
gormadapter "github.com/casbin/gorm-adapter/v3"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/model/system"
|
||||
systemReq "git.echol.cn/loser/Go-Web-Template/server/model/system/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/model/common"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
@@ -16,35 +16,35 @@ func TestGetJSONKeys(t *testing.T) {
|
||||
}`
|
||||
keys, err := GetJSONKeys(jsonStr)
|
||||
if err != nil {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys failed: %v", err)
|
||||
return
|
||||
}
|
||||
if len(keys) != 5 {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys unexpected key count: %d", len(keys))
|
||||
return
|
||||
}
|
||||
if keys[0] != "Name" {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys unexpected first key: %s", keys[0])
|
||||
|
||||
return
|
||||
}
|
||||
if keys[1] != "TableName" {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys unexpected second key: %s", keys[1])
|
||||
|
||||
return
|
||||
}
|
||||
if keys[2] != "TemplateID" {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys unexpected third key: %s", keys[2])
|
||||
|
||||
return
|
||||
}
|
||||
if keys[3] != "TemplateInfo" {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys unexpected fourth key: %s", keys[3])
|
||||
|
||||
return
|
||||
}
|
||||
if keys[4] != "Limit" {
|
||||
t.Errorf("GetJSONKeys failed" + err.Error())
|
||||
t.Errorf("GetJSONKeys unexpected fifth key: %s", keys[4])
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/model/system/request"
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/global"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
@@ -18,9 +18,9 @@ const (
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
Os Os `json:"os"`
|
||||
Cpu Cpu `json:"cpu"`
|
||||
Ram Ram `json:"ram"`
|
||||
Os Os `json:"os"`
|
||||
Cpu Cpu `json:"cpu"`
|
||||
Ram Ram `json:"ram"`
|
||||
Disk []Disk `json:"disk"`
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ type Ram struct {
|
||||
|
||||
type Disk struct {
|
||||
MountPoint string `json:"mountPoint"`
|
||||
UsedMB int `json:"usedMb"`
|
||||
UsedGB int `json:"usedGb"`
|
||||
TotalMB int `json:"totalMb"`
|
||||
TotalGB int `json:"totalGb"`
|
||||
UsedPercent int `json:"usedPercent"`
|
||||
UsedMB int `json:"usedMb"`
|
||||
UsedGB int `json:"usedGb"`
|
||||
TotalMB int `json:"totalMb"`
|
||||
TotalGB int `json:"totalGb"`
|
||||
UsedPercent int `json:"usedPercent"`
|
||||
}
|
||||
|
||||
//@author: [SliverHorn](https://github.com/SliverHorn)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/model/common/request"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user