alibaba/IOC-golang

[Enhancement] Add comment in zz_generated.ioc.go

开放

#44 创建于 2022年6月19日

 (0 条评论) (0 个反应) (0 位负责人)Go (123 个派生)auto 404
good first issue

仓库指标

星标
 (1,230 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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
}



贡献者指南