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

added generic ResolveT and "must" methods #39

Merged
merged 1 commit into from Apr 15, 2022

Conversation

Place1
Copy link
Contributor

@Place1 Place1 commented Apr 15, 2022

This PR adds the following methods:

c := container.New()

db, err := container.ResolveT[Database](c)
if err != nil {
    // error
}

db := container.MustResolveT[Database](c)

container.MustSingleton(c, resolver)
container.MustNamedSingleton(c, "", resolver)
container.MustTransient(c, resolver)
container.MustNamedTransient(c, "", resolver)
container.MustCall(c, receiver)

container.go Show resolved Hide resolved
generics.go Show resolved Hide resolved
go.mod Show resolved Hide resolved
must.go Show resolved Hide resolved
@miladrahimi
Copy link
Member

Thanks for your contribution. I'm checking the changes and wondering is it possible to separate different feature using different branches and pull requests?

@Place1
Copy link
Contributor Author

Place1 commented Apr 15, 2022

How do you mean?

@miladrahimi
Copy link
Member

At least three branchs (PRs) are needed.

  1. Must
  2. Generics
  3. Error for Call method.

@Place1
Copy link
Contributor Author

Place1 commented Apr 15, 2022

Yeah sure, I was hoping to do them all together but I can cherry-pick them into different PRs if you'd like.

@miladrahimi miladrahimi merged commit c85308b into golobby:master Apr 15, 2022
@Place1
Copy link
Contributor Author

Place1 commented Apr 15, 2022

thanks mate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants