Skip to content

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

Open
@LaurenceLiZhixin

Description

@LaurenceLiZhixin

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions