Skip to content
github-actions[bot] edited this page Sep 20, 2025 · 6 revisions

db

import "github.com/AarC10/GSW-V2/lib/db"

Index

func CreateQuery

func CreateQuery(measurements MeasurementGroup) string

CreateQuery generates InfluxDB query for measurement group

type Handler

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
}

type InfluxDBV1Handler

InfluxDBV1Handler is a DB Handler implementation for InfluxDB v1

type InfluxDBV1Handler struct {
    // contains filtered or unexported fields
}

func (*InfluxDBV1Handler) Close

func (h *InfluxDBV1Handler) Close() error

Close closes the InfluxDB UDP client when done

func (*InfluxDBV1Handler) CreateQuery

func (h *InfluxDBV1Handler) CreateQuery(measurements MeasurementGroup) string

CreateQuery generates InfluxDB query for measurement group

func (*InfluxDBV1Handler) Initialize

func (h *InfluxDBV1Handler) Initialize(host string, port int) error

Initialize sets up the InfluxDB UDP connection

func (*InfluxDBV1Handler) Insert

func (h *InfluxDBV1Handler) Insert(measurements MeasurementGroup) error

Insert sends the measurement group data to InfluxDB using UDP

type Measurement

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
}

type MeasurementGroup

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

Clone this wiki locally