Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change package name to make code more readable #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/data
/internal/app/test/data
/tmp
/vendor

# IDE configs
.idea
Expand Down
4 changes: 2 additions & 2 deletions internal/app/bll/b_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package bll
import (
"context"

"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
"github.com/LyricTian/gin-admin/v7/internal/app/schema"
"github.com/LyricTian/gin-admin/v7/pkg/errors"
"github.com/LyricTian/gin-admin/v7/pkg/util/uuid"
Expand All @@ -15,7 +15,7 @@ var DemoSet = wire.NewSet(wire.Struct(new(Demo), "*"))

// Demo 示例程序
type Demo struct {
DemoModel *model.Demo
DemoModel *service.Demo
}

// Query 查询数据
Expand Down
14 changes: 7 additions & 7 deletions internal/app/bll/b_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sort"

"github.com/LyricTian/captcha"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
"github.com/LyricTian/gin-admin/v7/internal/app/schema"
"github.com/LyricTian/gin-admin/v7/pkg/auth"
"github.com/LyricTian/gin-admin/v7/pkg/errors"
Expand All @@ -20,12 +20,12 @@ var LoginSet = wire.NewSet(wire.Struct(new(Login), "*"))
// Login 登录管理
type Login struct {
Auth auth.Auther
UserModel *model.User
UserRoleModel *model.UserRole
RoleModel *model.Role
RoleMenuModel *model.RoleMenu
MenuModel *model.Menu
MenuActionModel *model.MenuAction
UserModel *service.User
UserRoleModel *service.UserRole
RoleModel *service.Role
RoleMenuModel *service.RoleMenu
MenuModel *service.Menu
MenuActionModel *service.MenuAction
}

// GetCaptcha 获取图形验证码信息
Expand Down
10 changes: 5 additions & 5 deletions internal/app/bll/b_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/LyricTian/gin-admin/v7/internal/app/contextx"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
"github.com/LyricTian/gin-admin/v7/internal/app/schema"
"github.com/LyricTian/gin-admin/v7/pkg/errors"
"github.com/LyricTian/gin-admin/v7/pkg/util/uuid"
Expand All @@ -18,10 +18,10 @@ var MenuSet = wire.NewSet(wire.Struct(new(Menu), "*"))

// Menu 菜单管理
type Menu struct {
TransModel *model.Trans
MenuModel *model.Menu
MenuActionModel *model.MenuAction
MenuActionResourceModel *model.MenuActionResource
TransModel *service.Trans
MenuModel *service.Menu
MenuActionModel *service.MenuAction
MenuActionResourceModel *service.MenuActionResource
}

// InitData 初始化菜单数据
Expand Down
10 changes: 5 additions & 5 deletions internal/app/bll/b_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package bll
import (
"context"

"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
"github.com/LyricTian/gin-admin/v7/internal/app/schema"
"github.com/LyricTian/gin-admin/v7/pkg/errors"
"github.com/LyricTian/gin-admin/v7/pkg/util/uuid"
Expand All @@ -17,10 +17,10 @@ var RoleSet = wire.NewSet(wire.Struct(new(Role), "*"))
// Role 角色管理
type Role struct {
Enforcer *casbin.SyncedEnforcer
TransModel *model.Trans
RoleModel *model.Role
RoleMenuModel *model.RoleMenu
UserModel *model.User
TransModel *service.Trans
RoleModel *service.Role
RoleMenuModel *service.RoleMenu
UserModel *service.User
}

// Query 查询数据
Expand Down
10 changes: 5 additions & 5 deletions internal/app/bll/b_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package bll
import (
"context"

"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
"github.com/LyricTian/gin-admin/v7/internal/app/schema"
"github.com/LyricTian/gin-admin/v7/pkg/errors"
"github.com/LyricTian/gin-admin/v7/pkg/util/hash"
Expand All @@ -18,10 +18,10 @@ var UserSet = wire.NewSet(wire.Struct(new(User), "*"))
// User 用户管理
type User struct {
Enforcer *casbin.SyncedEnforcer
TransModel *model.Trans
UserModel *model.User
UserRoleModel *model.UserRole
RoleModel *model.Role
TransModel *service.Trans
UserModel *service.User
UserRoleModel *service.UserRole
RoleModel *service.Role
}

// Query 查询数据
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model
package service

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package model
package service

import "github.com/google/wire"

// ModelSet model注入
var ModelSet = wire.NewSet(
// ServiceSet model注入
var ServiceSet = wire.NewSet(
DemoSet,
MenuActionResourceSet,
MenuActionSet,
Expand Down
12 changes: 6 additions & 6 deletions internal/app/module/adapter/casbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
"github.com/LyricTian/gin-admin/v7/internal/app/schema"
"github.com/LyricTian/gin-admin/v7/pkg/logger"
casbinModel "github.com/casbin/casbin/v2/model"
Expand All @@ -19,11 +19,11 @@ var CasbinAdapterSet = wire.NewSet(wire.Struct(new(CasbinAdapter), "*"), wire.Bi

// CasbinAdapter casbin适配器
type CasbinAdapter struct {
RoleModel *model.Role
RoleMenuModel *model.RoleMenu
MenuResourceModel *model.MenuActionResource
UserModel *model.User
UserRoleModel *model.UserRole
RoleModel *service.Role
RoleMenuModel *service.RoleMenu
MenuResourceModel *service.MenuActionResource
UserModel *service.User
UserRoleModel *service.UserRole
}

// LoadPolicy loads all policy rules from the storage.
Expand Down
4 changes: 2 additions & 2 deletions internal/app/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
"github.com/LyricTian/gin-admin/v7/internal/app/router"
"github.com/google/wire"

"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/model"
"github.com/LyricTian/gin-admin/v7/internal/app/model/gormx/service"
)

// BuildInjector 生成注入器
func BuildInjector() (*Injector, func(), error) {
wire.Build(
// mock.MockSet,
InitGormDB,
model.ModelSet,
service.ServiceSet,
InitAuth,
InitCasbin,
InitGinEngine,
Expand Down
23 changes: 12 additions & 11 deletions internal/app/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.