-
Notifications
You must be signed in to change notification settings - Fork 620
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
API improvement. Have a more idiomatic go API. #492
Comments
Other possibilities. To enforce that some parameters are mandatory r.channel.QueueDeclare("foo", amqp.AutoDelete) where type Option func(interface{})
var AutoDelete Option = func(v interface{}) {
opts := v.(*queueDeclare)
opts.AutoDelete = true
}
func (ch *Channel) QueueDeclare(queue string, options Option...) {
var cmd = queueDeclare{Queue: queue}
applyOptions(&cmd, options) // some helper
...
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That kind of code:
is quite difficult to read. Maybe rabbitmq specialists have no problem parsing this, but I have. And so my colleagues reviewing my code. So I'm writing this:
I really wish I could write that:
more example
So, maybe you should expose your implementation as public stuff. Internally, you're doing exactly that:
ch.call(someType)
is really the best readable API, please expose it, it's brilliant.Thanks
The text was updated successfully, but these errors were encountered: