/
zz_generated.ioc.go
81 lines (71 loc) · 1.73 KB
/
zz_generated.ioc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Code generated by iocli, run 'iocli gen' to re-generate
package user
import (
autowire "github.com/alibaba/ioc-golang/autowire"
normal "github.com/alibaba/ioc-golang/autowire/normal"
singleton "github.com/alibaba/ioc-golang/autowire/singleton"
util "github.com/alibaba/ioc-golang/autowire/util"
)
func init() {
normal.RegisterStructDescriptor(&autowire.StructDescriptor{
Factory: func() interface{} {
return &app_{}
},
})
appStructDescriptor := &autowire.StructDescriptor{
Factory: func() interface{} {
return &App{}
},
ParamFactory: func() interface{} {
var _ paramInterface = &Param{}
return &Param{}
},
ConstructFunc: func(i interface{}, p interface{}) (interface{}, error) {
param := p.(paramInterface)
impl := i.(*App)
return param.Init(impl)
},
Metadata: map[string]interface{}{
"aop": map[string]interface{}{},
"autowire": map[string]interface{}{},
},
}
singleton.RegisterStructDescriptor(appStructDescriptor)
}
type paramInterface interface {
Init(impl *App) (*App, error)
}
type app_ struct {
Run_ func()
}
func (a *app_) Run() {
a.Run_()
}
type AppIOCInterface interface {
Run()
}
var _appSDID string
func GetAppSingleton(p *Param) (*App, error) {
if _appSDID == "" {
_appSDID = util.GetSDIDByStructPtr(new(App))
}
i, err := singleton.GetImpl(_appSDID, p)
if err != nil {
return nil, err
}
impl := i.(*App)
return impl, nil
}
func GetAppIOCInterfaceSingleton(p *Param) (AppIOCInterface, error) {
if _appSDID == "" {
_appSDID = util.GetSDIDByStructPtr(new(App))
}
i, err := singleton.GetImplWithProxy(_appSDID, p)
if err != nil {
return nil, err
}
impl := i.(AppIOCInterface)
return impl, nil
}