File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,21 @@ type ClientOptionsReader struct {
3030 options * ClientOptions
3131}
3232
33+ // NewOptionsReader creates a ClientOptionsReader, this should only be used for mocking purposes.
34+ //
35+ // An example implementation:
36+ //
37+ // func (c *mqttClientMock) OptionsReader() mqtt.ClientOptionsReader {
38+ // opts := mqtt.NewClientOptions()
39+ // opts.UserName = "TestUserName"
40+ // return mqtt.NewOptionsReader(opts)
41+ // }
42+ func NewOptionsReader (o * ClientOptions ) ClientOptionsReader {
43+ return ClientOptionsReader {
44+ options : o ,
45+ }
46+ }
47+
3348// Servers returns a slice of the servers defined in the clientoptions
3449func (r * ClientOptionsReader ) Servers () []* url.URL {
3550 s := make ([]* url.URL , len (r .options .Servers ))
You can’t perform that action at this time.
0 commit comments