Documentation
¶
Index ¶
- Variables
- func GetKeyExampleService(ns ...string) string
- func GetKeyHealthService(ns ...string) string
- func GetKeyTestService(ns ...string) string
- func RegisterKeyTestService(ctx frame.ContextFramer, ns ...string) string
- type ExampleService
- func (s *ExampleService) CreateExample(vo *requestvo.ExampleReqVo) (string, error)
- func (s *ExampleService) GetExample(id string) (*responsevo.ExampleRespVo, error)
- func (s *ExampleService) GetExampleWithTaskDispatcher(id string) (*responsevo.ExampleRespVo, error)
- func (s *ExampleService) GetExamples(page, size int) ([]responsevo.ExampleRespVo, error)
- type HealthService
- type TestService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ExampleServiceWireSet = wire.NewSet(NewExampleService) HealthServiceProvide = wire.NewSet(NewHealthService, repository.NewHealthRepository) )
wire: a call to wire.Build indicates that this function is an injector, but injectors must consist of only the wire.Build call and an optional return
Functions ¶
func GetKeyExampleService ¶
GetKeyExampleService 获取 ExampleService 注册键名
func GetKeyHealthService ¶
func GetKeyTestService ¶
GetKeyTestService 获取 TestService 注册键名
func RegisterKeyTestService ¶
func RegisterKeyTestService(ctx frame.ContextFramer, ns ...string) string
RegisterKeyTestService 注册 TestService 实例初始化器到全局管理器,并返回注册实例key;该方法可由依赖方法调用,或由组件使用,无需wire或其他依赖注入工具
Types ¶
type ExampleService ¶
type ExampleService struct {
frame.ServiceLocator // 继承服务定位器接口
Repo *repository.ExampleRepository // 依赖的组件: 样例仓库,构造参数注入。由wire自动注入
}
ExampleService 样例服务,继承 frame.ServiceLocator 服务定位器接口,具备获取上下文、配置、日志、注册实例等功能
func NewExampleService ¶
func NewExampleService(ctx frame.ContextFramer, repo *repository.ExampleRepository) *ExampleService
func (*ExampleService) CreateExample ¶
func (s *ExampleService) CreateExample(vo *requestvo.ExampleReqVo) (string, error)
func (*ExampleService) GetExample ¶
func (s *ExampleService) GetExample(id string) (*responsevo.ExampleRespVo, error)
func (*ExampleService) GetExampleWithTaskDispatcher ¶
func (s *ExampleService) GetExampleWithTaskDispatcher(id string) (*responsevo.ExampleRespVo, error)
GetExampleWithTaskDispatcher 示例方法,演示如何在服务方法中使用任务调度器异步执行任务
func (*ExampleService) GetExamples ¶
func (s *ExampleService) GetExamples(page, size int) ([]responsevo.ExampleRespVo, error)
type HealthService ¶
type HealthService struct {
frame.ServiceLocator
Resp *repository.HealthRepository
}
func NewHealthService ¶
func NewHealthService(ctx frame.ContextFramer, resp *repository.HealthRepository) *HealthService
func (*HealthService) GetHealth ¶
func (s *HealthService) GetHealth() string
type TestService ¶
type TestService struct {
frame.ServiceLocator
KeyExampleRepository string
}
func NewTestService ¶
func NewTestService(ctx frame.ContextFramer) *TestService
func (*TestService) DoAgeDoubleCreateForTaskHandle ¶
func (s *TestService) DoAgeDoubleCreateForTaskHandle(age int8) (int, error)
DoAgeDoubleCreateForTaskHandle 示例任务处理函数
Click to show internal directories.
Click to hide internal directories.