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

关于service层的疑惑 #34

Closed
FirYuen opened this issue Jun 30, 2021 · 2 comments
Closed

关于service层的疑惑 #34

FirYuen opened this issue Jun 30, 2021 · 2 comments

Comments

@FirYuen
Copy link

FirYuen commented Jun 30, 2021

目前的结构在service层写了所有的方法,每次调用时会比较难找到自己想要的方法
比如 目前的架构中 定义了
var (
UserSvc *Service
VCodeSvc *Service
)
但是在handler中调用service.UserSvc时,ide也会提示VCodeSvc下的相关方法,有优化的方式吗

@FirYuen FirYuen changed the title service 关于service层的疑惑 Jun 30, 2021
@qloog
Copy link
Contributor

qloog commented Jun 30, 2021

可以把 service 按职责分开,比如用户一个service, 订单一个service, 分别有自己的New方法(NewUserService, NewOrderService),目前是一个大service, 一个New,所有的都在一个下面,就会有你说的这种问题。

@FirYuen
Copy link
Author

FirYuen commented Jun 30, 2021

可以把 service 按职责分开,比如用户一个service, 订单一个service, 分别有自己的New方法(NewUserService, NewOrderService),目前是一个大service, 一个New,所有的都在一个下面,就会有你说的这种问题。

谢谢解答!很有用!

@FirYuen FirYuen closed this as completed Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants