Skip to content

Use ConfigOption withxxxx for simple usage #68

Open
@xujianhai666

Description

@xujianhai666

Is your feature request related to a problem? Please describe.
now, when we use client 、producer、consumer, we must provide ClientOption, ProducerOption and ConsumerOption, but there are many params on Option, which puzzle users.
according to Rob Pike: https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and Dave cheney: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis , we should use WithXXX. for example:

type ClientOption func(opts ClientOptions) 
func WithURL(URL string) ClientOption {
    return func(opts ClientOptions) {
         .....
    }
}

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedanyone who are interested in could help on it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions