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 constructFunc=init support to make construct function more clear. #22

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

Comments

@LaurenceLiZhixin
Copy link
Collaborator

LaurenceLiZhixin commented Jun 5, 2022

Now our construction function's mark is like:

// +ioc:autowire=true
// +ioc:autowire:type=normal
// +ioc:autowire:paramType=Param
// +ioc:autowire:constructFunc=Init

Param.Init() is registered as construct function. But sometime there is no need for param, developers can use a simple function to create object like.

func constructFunction(impl *MyObject)(*MyObject,error){
    impl.ID = "xxx"
    return impl, nil
}

We should support both marks:

// +ioc:autowire:paramType=Param
// +ioc:autowire:constructFunc=Init
// to use Param.Init() as construct function with loaded params.

// +ioc:autowire:constructFunc=myConstructFunction
// to use myConstructFunction() as construct function.
@LaurenceLiZhixin LaurenceLiZhixin added the good first issue Good for newcomers label Jun 5, 2022
@LaurenceLiZhixin LaurenceLiZhixin changed the title [Enhancement] Add constructFunc=Param.Init to make construct function more clear. [Enhancement] Add constructFunc=Init to make construct function more clear. Jun 14, 2022
@LaurenceLiZhixin LaurenceLiZhixin changed the title [Enhancement] Add constructFunc=Init to make construct function more clear. [Enhancement] Add constructFunc=init to make construct function more clear. Jun 14, 2022
@LaurenceLiZhixin LaurenceLiZhixin changed the title [Enhancement] Add constructFunc=init to make construct function more clear. [Enhancement] Add constructFunc=init support to make construct function more clear. Jun 14, 2022
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