refactor(db): add constante for max QOS

This commit is contained in:
2026-06-04 13:21:57 +02:00
parent f4ab3093c3
commit 0f30749534

View File

@@ -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")
}