mysql

package
v0.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIMESTAMP_FORMAT = "2006-01-02 15:04:05"
	MYSQL_URL_FORMAT = "%s:%s@(%s)/%s"
	MYSQL_QUERY      = "Insert Into %s (DeviceName,TelemetryData,TelemetryTimeStamp) Values('%s','%s','%s')"
	MYSQL            = "mysql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBHelper

type DBHelper struct {
	DB       *sql.DB
	Settings *v1alpha1.SQLConnectionSetting
}

func (*DBHelper) ConnectToDB

func (db *DBHelper) ConnectToDB(ctx context.Context) error

func (*DBHelper) InsertDataToDB

func (db *DBHelper) InsertDataToDB(ctx context.Context, deviceName string, rawData []byte) error

This table stores telemetry data from various devices. CREATE TABLE ${DbTableName} (

    TelemetryID INT AUTO_INCREMENT PRIMARY KEY,
    DeviceName VARCHAR(255),
    TelemetryData TEXT,
    TelemetryTimeStamp TIMESTAMP
)

The table is used to track telemetry information for analysis and monitoring.

func (*DBHelper) SendToDB

func (db *DBHelper) SendToDB(ctx context.Context, deviceName string, rawData []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL