service

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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

func GetKeyExampleService(ns ...string) string

GetKeyExampleService 获取 ExampleService 注册键名

func GetKeyHealthService

func GetKeyHealthService(ns ...string) string

func GetKeyTestService

func GetKeyTestService(ns ...string) string

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 (*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 (*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 示例任务处理函数

func (*TestService) HelloWorld

func (s *TestService) HelloWorld() string

HelloWorld 示例方法

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL