Expose interfaces when possible
sruehl opened this issue · comments
Sebastian Rühl commented
When using this library it's hard to write mocks.
This is due to the fact that some methods expose structs.
func (q *Queue) Consumer() *taskq.Consumer {
if q.consumer == nil {
q.consumer = taskq.NewConsumer(q)
}
return q.consumer
}
So I would propose to write interfaces whenever you have objects that provide interactions to allow writing mocks for the API without the need for doing something like described here.
I will prepare a PR containing the changes.