You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to solve this problem, using db as global variable. However, would be better if I could pass it to my callback (that today, accepts just two params - user and password). Could you support a variable number of params, where I could for example pass the db handle? I stumbled many times in this question and either I found a "use another middlewear" or "set your db variable global"..
The text was updated successfully, but these errors were encountered:
attilaolah
changed the title
pattern to integrate db interaction in the auth.BasicFunc callback
Make BasicFunc support dependency injection
Feb 19, 2015
This is a little tricky because (I think) we would have to inject the username and password in the context as well in order for BasicFunc to be able to access it.
You can, however, do that with an interface, but that seems like too much complexity. After all, you could just pass in the db in a closure. Or pass in a method to auth.BasicFunc, and have the method access the db via the struct.
Summary: what you want can already be achieved without DI. I don't see a great need for DI here, but, if someone wants to implement this, why not. Just send a PR.
I was able to solve this problem, using db as global variable. However, would be better if I could pass it to my callback (that today, accepts just two params - user and password). Could you support a variable number of params, where I could for example pass the db handle? I stumbled many times in this question and either I found a "use another middlewear" or "set your db variable global"..
The text was updated successfully, but these errors were encountered: