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