mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	feat: 新增简易版ioc
This commit is contained in:
		@@ -1,11 +1,14 @@
 | 
			
		||||
package persistence
 | 
			
		||||
 | 
			
		||||
import "mayfly-go/internal/msg/domain/repository"
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	msgRepo = newMsgRepo()
 | 
			
		||||
import (
 | 
			
		||||
	"mayfly-go/internal/msg/domain/repository"
 | 
			
		||||
	"mayfly-go/pkg/ioc"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func GetMsgRepo() repository.Msg {
 | 
			
		||||
	return msgRepo
 | 
			
		||||
func Init() {
 | 
			
		||||
	ioc.Register(newMsgRepo(), ioc.WithComponentName("MsgRepo"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func GetMsgRepo() repository.Msg {
 | 
			
		||||
	return ioc.Get[repository.Msg]("msgRepo")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user