From 0f30749534d253eb56d152108197eca5715ac44a Mon Sep 17 00:00:00 2001 From: Klagarge Date: Thu, 4 Jun 2026 13:21:57 +0200 Subject: [PATCH] refactor(db): add constante for max QOS --- db/src/mqtt/mqtt.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/src/mqtt/mqtt.go b/db/src/mqtt/mqtt.go index 05d8e46..c6e6968 100644 --- a/db/src/mqtt/mqtt.go +++ b/db/src/mqtt/mqtt.go @@ -14,6 +14,8 @@ import ( mqtt "github.com/eclipse/paho.mqtt.golang" ) +const maxQoS = 2 + // A MqttParams is the abstracted MQTT gateway. // It provides the MQTT parameters to initialize the connection and the method to add data. type MqttParams struct { @@ -69,7 +71,7 @@ func NewMqttGateway(p MqttParams) (*MqttGateway, error) { return nil, errors.New("[MQTT Gateway] Invalid client id") } - if p.Qos > 2 { + if p.Qos > maxQoS { return nil, errors.New("[MQTT Gateway] Invalid QoS level") }