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

redisConnection unexported ?? #40

Closed
iomatters opened this issue Jul 20, 2018 · 5 comments
Closed

redisConnection unexported ?? #40

iomatters opened this issue Jul 20, 2018 · 5 comments

Comments

@iomatters
Copy link

Was it done on purpose ? :)

@wellle
Copy link
Member

wellle commented Jul 20, 2018

Yes. You should never have to refer to it by specific type. Instead you should pass it around as rmq.Connection. That way you can actually use a rmq.TestConnection in tests without having to touch your code.

Or is there any case in which you'd actually need to refer to the specific type?

@iomatters
Copy link
Author

The case is pretty much typical. How can I normally share the same connection across different functions?

@wellle
Copy link
Member

wellle commented Jul 20, 2018

As I said, just pass it as rmq.Connection. For example:

func main() {
	yourConnection := rmq.OpenConnection("your-tag", "tcp", "localhost:3456", 1)
	yourQueue := YourFunction(yourConnection)
}

func YourFunction(queueConnection rmq.Connection) rmq.Queue {
	return queueConnection.OpenQueue("your-queue")
}

@iomatters
Copy link
Author

Yeah, I looked it over, that's what I need, thank you!

@wellle
Copy link
Member

wellle commented Jul 22, 2018

Alright, I'll close this then 👍

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

No branches or pull requests

2 participants