Skip to content

Commit

Permalink
fix:bug修复
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaosu committed Jul 4, 2023
1 parent db234db commit a11b3c1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
3 changes: 0 additions & 3 deletions protoc-gen-go-crud/internal/authorization/deliveries/role.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package deliveries

import (
authorizationV1 "github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/api/v1/authorization"
components "github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/api/v1/components"
"github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/internal/authorization/usecase"
"github.com/gin-gonic/gin"
empty "github.com/golang/protobuf/ptypes/empty"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type IAuthRepo interface {
CreateAuth(ctx context.Context, Auth *entities.Auth) error
UpdateAuth(ctx context.Context, updateFields []string, Auth *entities.Auth) error
GetAuth(ctx context.Context, id entity.ID) (*entities.Auth, error)
GetAuths(ctx context.Context, filter *database.Filter) (res []*entities.User, count int64, err error)
GetAuths(ctx context.Context, filter *database.Filter) (res []*entities.Auth, count int64, err error)
DeleteAuth(ctx context.Context, id entity.ID) error
Log(ctx context.Context) *zap.SugaredLogger
}
Expand Down Expand Up @@ -39,3 +39,7 @@ func (a AuthRepo) GetAuths(ctx context.Context, filter *database.Filter) (res []
func (a AuthRepo) Log(ctx context.Context) *zap.SugaredLogger {
return global.Logger(ctx).Named("AuthRepo")
}

func NewAuthRepo() IAuthRepo {
return &AuthRepo{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type IRoleRepo interface {
CreateRole(ctx context.Context, Role *entities.Role) error
UpdateRole(ctx context.Context, updateFields []string, Role *entities.Role) error
GetRole(ctx context.Context, id entity.ID) (*entities.Role, error)
GetRoles(ctx context.Context, filter *database.Filter) (res []*entities.User, count int64, err error)
GetRoles(ctx context.Context, filter *database.Filter) (res []*entities.Role, count int64, err error)
DeleteRole(ctx context.Context, id entity.ID) error
Log(ctx context.Context) *zap.SugaredLogger
}
Expand Down Expand Up @@ -39,3 +39,7 @@ func (r RoleRepo) GetRoles(ctx context.Context, filter *database.Filter) (res []
func (r RoleRepo) Log(ctx context.Context) *zap.SugaredLogger {
return global.Logger(ctx).Named("RoleRepo")
}

func NewRoleRepo() IRoleRepo {
return &RoleRepo{}
}
4 changes: 4 additions & 0 deletions protoc-gen-go-crud/internal/users/repositories/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ func (u UserRepo) GetUsers(ctx context.Context, filter *database.Filter) (res []
func (u UserRepo) Log(ctx context.Context) *zap.SugaredLogger {
return global.Logger(ctx).Named("UserRepo")
}

func NewUserRepo() IUserRepo {
return &UserRepo{}
}
Binary file modified protoc-gen-go-crud/protoc-gen-go-crud
Binary file not shown.
6 changes: 4 additions & 2 deletions protoc-gen-go-crud/repositories/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type I{{.ServiceType}}Repo interface {
Create{{.ServiceType}}(ctx context.Context, {{.ServiceType}} *entities.{{.ServiceType}}) error
Update{{.ServiceType}}(ctx context.Context, updateFields []string,{{.ServiceType}} *entities.{{.ServiceType}}) error
Get{{.ServiceType}}(ctx context.Context, id entity.ID) (*entities.{{.ServiceType}}, error)
Get{{.ServiceType}}s(ctx context.Context, filter *database.Filter) (res []*entities.User, count int64, err error)
Get{{.ServiceType}}s(ctx context.Context, filter *database.Filter) (res []*entities.{{.ServiceType}}, count int64, err error)
Delete{{.ServiceType}}(ctx context.Context, id entity.ID) error
Log(ctx context.Context) *zap.SugaredLogger
}
Expand Down Expand Up @@ -53,7 +53,9 @@ func ({{$firstLetter}} {{.ServiceType}}Repo) Log(ctx context.Context) *zap.Sugar
return global.Logger(ctx).Named("{{.ServiceType}}Repo")
}
func New{{.ServiceType}}Repo() I{{.ServiceType}}Repo{
return &{{.ServiceType}}Repo{}
}
`

type serviceDesc struct {
Expand Down

0 comments on commit a11b3c1

Please sign in to comment.