diff --git a/provider/config.go b/provider/config.go index 3ffa56be78..ee71706f01 100644 --- a/provider/config.go +++ b/provider/config.go @@ -11,9 +11,12 @@ var registry = reg.New[Provider]("plugin") // provider types type ( - Provider interface{} - IntProvider interface { - IntGetter() (func() (int64, error), error) + Provider interface{} + Getters interface { + StringProvider + FloatProvider + IntProvider + BoolProvider } StringProvider interface { StringGetter() (func() (string, error), error) @@ -21,18 +24,21 @@ type ( FloatProvider interface { FloatGetter() (func() (float64, error), error) } + IntProvider interface { + IntGetter() (func() (int64, error), error) + } BoolProvider interface { BoolGetter() (func() (bool, error), error) } - SetIntProvider interface { - IntSetter(param string) (func(int64) error, error) - } SetStringProvider interface { StringSetter(param string) (func(string) error, error) } SetFloatProvider interface { FloatSetter(param string) (func(float64) error, error) } + SetIntProvider interface { + IntSetter(param string) (func(int64) error, error) + } SetBoolProvider interface { BoolSetter(param string) (func(bool) error, error) } diff --git a/provider/http.go b/provider/http.go index 3f601386fe..4fca739d8c 100644 --- a/provider/http.go +++ b/provider/http.go @@ -178,7 +178,7 @@ func (p *HTTP) request(url string, body string) ([]byte, error) { return p.val, p.err } -var _ StringProvider = (*HTTP)(nil) +var _ Getters = (*HTTP)(nil) // StringGetter sends string request func (p *HTTP) StringGetter() (func() (string, error), error) { diff --git a/provider/mqtt.go b/provider/mqtt.go index 0f3ac5556c..fffe132ab0 100644 --- a/provider/mqtt.go +++ b/provider/mqtt.go @@ -113,7 +113,7 @@ func (m *Mqtt) newReceiver() (*msgHandler, error) { return h, err } -var _ StringProvider = (*Mqtt)(nil) +var _ Getters = (*Mqtt)(nil) // StringGetter creates handler for string from MQTT topic that returns cached value func (m *Mqtt) StringGetter() (func() (string, error), error) { diff --git a/provider/script.go b/provider/script.go index 5b3a791743..7ed25cb63f 100644 --- a/provider/script.go +++ b/provider/script.go @@ -106,7 +106,7 @@ func (p *Script) exec(script string) (string, error) { return s, nil } -var _ StringProvider = (*Script)(nil) +var _ Getters = (*Script)(nil) // StringGetter returns string from exec result. Only STDOUT is considered. func (p *Script) StringGetter() (func() (string, error), error) { diff --git a/provider/socket.go b/provider/socket.go index 67bbaacf99..5d7daebffb 100644 --- a/provider/socket.go +++ b/provider/socket.go @@ -145,7 +145,7 @@ func (p *Socket) run(errC chan error) { } } -var _ StringProvider = (*Socket)(nil) +var _ Getters = (*Socket)(nil) // StringGetter sends string request func (p *Socket) StringGetter() (func() (string, error), error) {