chore(db): typo and respect go guidelines

Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2026-04-30 13:26:31 +02:00
parent 567e9162e2
commit 1fb294f495
4 changed files with 12 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
# Deployement
# Deployment
1. Create the Influx token offline:

View File

@@ -9,13 +9,10 @@ import (
"github.com/InfluxCommunity/influxdb3-go/v2/influxdb3/batching"
)
// Number of points to batch before pushing to InfluxDB
const BATCH_SIZE = 50
const BatchSize = 50 // Number of points to batch before pushing to InfluxDB
const BatchCapacity = 50 // Capacity maximum of the buffer
// Capacity maximum of the buffer
const BATCH_CAPACITY = 50
// Gateway provides the abstraction of all gateway to send datapoints
// Gateway provides the abstraction of all gateways to send data points
type Gateway interface {
AddDatapoint(dp datapoint.DataPointInfo) error
Close() error
@@ -46,8 +43,8 @@ func NewInfluxGateway(url string, token string, database string) (*InfluxGateway
return &InfluxGateway{
client: client,
batcher: batching.NewBatcher(
batching.WithSize(BATCH_SIZE),
batching.WithInitialCapacity(BATCH_CAPACITY),
batching.WithSize(BatchSize),
batching.WithInitialCapacity(BatchCapacity),
),
},
nil
@@ -55,7 +52,7 @@ func NewInfluxGateway(url string, token string, database string) (*InfluxGateway
// AddDatapoint is used to add a datapoint in the batcher. It uses the
// DataPointInfo interface for abstracting the generic type of the DataPoint.
// It pushs the batch of point when the number of point >= batch size.
// It pushes the batch of point when the number of points >= batch size.
func (g *InfluxGateway) AddDatapoint(dp datapoint.DataPointInfo) error {
g.batcher.Add(

View File

@@ -34,7 +34,7 @@ type MqttGateway struct {
Client mqtt.Client
}
// mqttPayload is the JSON structure published to the broker in specific topic.
// mqttPayload is the JSON structure published to the broker in a specific topic.
// It contains the values and the timestamp of the data.
type mqttPayload map[string]any
@@ -109,7 +109,7 @@ func NewMqttGateway(p MqttParams) (*MqttGateway, error) {
}, nil
}
// SendData is used to send a data in the MQTT gateway.
// SendData is used to send data in the MQTT gateway.
// It uses the DataPointInfo interface for abstracting the generic type of the DataPoint
func (g *MqttGateway) SendData(msg data.MessageInfo) error {
topic := msg.Topic()

View File

@@ -20,7 +20,7 @@ type Measurement[T any] struct {
}
// A DataPoint represents values associated with a measurement, along with tags,
// values and a timestamp. It contains a pointer to its parent Measurement
// values, and a timestamp. It contains a pointer to its parent Measurement
type DataPoint[T any] struct {
measurement *Measurement[T]
tags map[string]string
@@ -57,8 +57,8 @@ func (dp *DataPoint[T]) GetValues() map[string]T {
return dp.values
}
// GetValuesAny returns the DataPoint value with type any.
// (usefull for adding the DataPoint for batching)
// GetValuesAsAny returns the DataPoint value with type any.
// (useful for adding the DataPoint for batching)
func (dp *DataPoint[T]) GetValuesAsAny() map[string]any {
anyValues := make(map[string]any)