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

move DI stuff for paychmgr into modules #5791

Merged
merged 4 commits into from
Mar 12, 2021
Merged

Conversation

whyrusleeping
Copy link
Member

This makes it easier to use the paychmgr package outside of lotus.

@whyrusleeping
Copy link
Member Author

I need one or two more things here... the paych manager thing still depends on some funky fx nonsense. manageAPIImpl is an unexported struct that requires an embedded other type thats fulfilled via the constructor with a magic fx.In PaychAPI struct (not interface).

This needs some untangling...

@whyrusleeping
Copy link
Member Author

@magik6k youre gonna have to take a look at that last commit, I dont think I really understand what I was doing there with the dependency injection.

@magik6k
Copy link
Contributor

magik6k commented Mar 12, 2021

Just needed to use the magic From, the difference it makes is that if you pass a non-function value as the second param to Override, it just gets put into the DI container.

The From will instead wrap it into a function returning the value, so it is pulled from DI (From(*T) -> func(t T) T {return t}) - which in case of structs with fx.In means that all the fields internal to the struct will get pulled from DI (and without the From they will just be nil)

(This should be better documented)

@magik6k magik6k merged commit 067af44 into master Mar 12, 2021
@magik6k magik6k deleted the feat/paychmgr-imports branch March 12, 2021 15:29
@whyrusleeping
Copy link
Member Author

Aha! that makes sense, thanks :)

@magik6k magik6k mentioned this pull request Apr 13, 2021
69 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants