-
Notifications
You must be signed in to change notification settings - Fork 1
github-actions[bot] edited this page Sep 20, 2025
·
6 revisions
import "github.com/AarC10/GSW-V2/lib/db"- func CreateQuery(measurements MeasurementGroup) string
- type Handler
- type InfluxDBV1Handler
- type Measurement
- type MeasurementGroup
func CreateQuery(measurements MeasurementGroup) stringCreateQuery generates InfluxDB query for measurement group
Handler is an interface for database access implementations
type Handler interface {
// Initialize sets up the database client
Initialize(host string, port int) error
// Insert sends the measurement data to the database
Insert(measurements MeasurementGroup) error
// CreateQuery generates the database query for measurementGroup
CreateQuery(measurements MeasurementGroup) string
// Close closes the database client when done
Close() error
}InfluxDBV1Handler is a DB Handler implementation for InfluxDB v1
type InfluxDBV1Handler struct {
// contains filtered or unexported fields
}func (h *InfluxDBV1Handler) Close() errorClose closes the InfluxDB UDP client when done
func (h *InfluxDBV1Handler) CreateQuery(measurements MeasurementGroup) stringCreateQuery generates InfluxDB query for measurement group
func (h *InfluxDBV1Handler) Initialize(host string, port int) errorInitialize sets up the InfluxDB UDP connection
func (h *InfluxDBV1Handler) Insert(measurements MeasurementGroup) errorInsert sends the measurement group data to InfluxDB using UDP
Measurement is a single measurement to be sent to the database
type Measurement struct {
Name string // Name of the measurement
Value string // Value of the measurement
}MeasurementGroup is a group of measurements to be sent to the database
type MeasurementGroup struct {
DatabaseName string // Name of the database
Timestamp int64 // Unix timestamp in nanoseconds
Measurements []Measurement // List of measurements to be sent
}Generated by gomarkdoc