mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 08:20:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package application
 | 
						|
 | 
						|
import (
 | 
						|
	"mayfly-go/pkg/ioc"
 | 
						|
	"sync"
 | 
						|
)
 | 
						|
 | 
						|
func InitIoc() {
 | 
						|
	ioc.Register(new(machineAppImpl), ioc.WithComponentName("MachineApp"))
 | 
						|
	ioc.Register(new(machineFileAppImpl), ioc.WithComponentName("MachineFileApp"))
 | 
						|
	ioc.Register(new(machineScriptAppImpl), ioc.WithComponentName("MachineScriptApp"))
 | 
						|
	ioc.Register(new(machineCronJobAppImpl), ioc.WithComponentName("MachineCronJobApp"))
 | 
						|
	ioc.Register(new(machineTermOpAppImpl), ioc.WithComponentName("MachineTermOpApp"))
 | 
						|
	ioc.Register(new(machineCmdConfAppImpl), ioc.WithComponentName("MachineCmdConfApp"))
 | 
						|
}
 | 
						|
 | 
						|
func Init() {
 | 
						|
	sync.OnceFunc(func() {
 | 
						|
		GetMachineCronJobApp().InitCronJob()
 | 
						|
 | 
						|
		GetMachineApp().TimerUpdateStats()
 | 
						|
 | 
						|
		GetMachineTermOpApp().TimerDeleteTermOp()
 | 
						|
	})()
 | 
						|
}
 | 
						|
 | 
						|
func GetMachineApp() Machine {
 | 
						|
	return ioc.Get[Machine]("MachineApp")
 | 
						|
}
 | 
						|
 | 
						|
func GetMachineFileApp() MachineFile {
 | 
						|
	return ioc.Get[MachineFile]("MachineFileApp")
 | 
						|
}
 | 
						|
 | 
						|
func GetMachineScriptApp() MachineScript {
 | 
						|
	return ioc.Get[MachineScript]("MachineScriptApp")
 | 
						|
}
 | 
						|
 | 
						|
func GetMachineCronJobApp() MachineCronJob {
 | 
						|
	return ioc.Get[MachineCronJob]("MachineCronJobApp")
 | 
						|
}
 | 
						|
 | 
						|
func GetMachineTermOpApp() MachineTermOp {
 | 
						|
	return ioc.Get[MachineTermOp]("MachineTermOpApp")
 | 
						|
}
 |