mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
update proxy/options
This commit is contained in:
parent
2cc18d6edc
commit
c317daf6b8
@ -18,15 +18,8 @@ func (d *defaultOptions) Init(opts ...Option) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *defaultOptions) Options() Options {
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *defaultOptions) Value(k interface{}) (interface{}, bool) {
|
||||
if d.opts == nil {
|
||||
d.opts = new(Values)
|
||||
}
|
||||
return d.opts.Get(k)
|
||||
func (d *defaultOptions) Values() *Values {
|
||||
return d.opts
|
||||
}
|
||||
|
||||
func (d *defaultOptions) String() string {
|
||||
|
@ -9,9 +9,7 @@ type Options interface {
|
||||
// Initialise options
|
||||
Init(...Option) error
|
||||
// Options returns the current options
|
||||
Options() Options
|
||||
// Value returns an option value
|
||||
Value(k interface{}) (interface{}, bool)
|
||||
Values() *Values
|
||||
// The name for who these options exist
|
||||
String() string
|
||||
}
|
||||
@ -62,7 +60,7 @@ func WithOption(o Option) Option {
|
||||
}
|
||||
|
||||
// String sets the string
|
||||
func String(s string) Option {
|
||||
func WithString(s string) Option {
|
||||
return WithValue(stringKey{}, s)
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,4 @@ type Proxy interface {
|
||||
options.Options
|
||||
// ServeRequest will serve a request
|
||||
ServeRequest(context.Context, server.Request, server.Response) error
|
||||
// run the proxy
|
||||
Run() error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user