Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Add comment in zz_generated.ioc.go #44

Open
LaurenceLiZhixin opened this issue Jun 19, 2022 · 0 comments
Open

[Enhancement] Add comment in zz_generated.ioc.go #44

LaurenceLiZhixin opened this issue Jun 19, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@LaurenceLiZhixin
Copy link
Collaborator

LaurenceLiZhixin commented Jun 19, 2022

At present, the zz_generated.ioc.go file generated by the framework is not readable, so it is necessary to add Chinese and English explanations to the generated code, namely the meaning and purpose of each module. Such as:

// struct descriptor registry, these code contains all life cycle definition of the defined struct.
// 结构描述符定义部分,该部分包含了提供结构的生命周期信息。
func init() {
	normal.RegisterStructDescriptor(&autowire.StructDescriptor{
		Factory: func() interface{} {
			return &app_{}
		},
	})
...

// GetApp is getter function of App struct, it returns App struct pointer
// GetApp 是 App 结构的 get 方法,可以返回 App 结构指针
func GetApp() (*App, error) {
	i, err := singleton.GetImpl(util.GetSDIDByStructPtr(new(App)), nil)
	if err != nil {
		return nil, err
	}
	impl := i.(*App)
	return impl, nil
}

// GetAppIOCInterface is getter function of App owned interface 'AppIOCInterface', the returned interface contains proxy layer.
// GetAppIOCInterface 是 App 结构专属接口的 get 方法,他返回的接口封装了 App 结构的代理层。
func GetAppIOCInterface() (AppIOCInterface, error) {
	i, err := singleton.GetImplWithProxy(util.GetSDIDByStructPtr(new(App)), nil)
	if err != nil {
		return nil, err
	}
	impl := i.(AppIOCInterface)
	return impl, nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant