Documentation
¶
Overview ¶
- Uses TimescaleDB for storing measurements in hypertables. - TimescaleDB tables do not support primary keys. - Contains CRUD operations for sensor_measurement table.
- Contains CRUD operations for sensor table.
Index ¶
- Variables
- func DeleteSensor(serialNumber string) error
- func GetSensorIDBySerialNumber(serialNumber string) (sensorID int, err error)
- func WriteLog(sensorLog SensorLogRecord) error
- func WriteSensor(sr SensorRecord) error
- func WriteTarget(tr TargetRecord) error
- type DB
- type SensorLogRecord
- type SensorMeasurementRecord
- type SensorRecord
- type TargetRecord
Constants ¶
This section is empty.
Variables ¶
View Source
var (
PostgresConnString = os.Getenv("POSTGRES_CONN_STRING")
)
Relational Database
Functions ¶
func DeleteSensor ¶
func WriteLog ¶
func WriteLog(sensorLog SensorLogRecord) error
func WriteSensor ¶
func WriteSensor(sr SensorRecord) error
func WriteTarget ¶
func WriteTarget(tr TargetRecord) error
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) WriteMeasurement ¶
func (DB *DB) WriteMeasurement(ctx context.Context, measurement SensorMeasurementRecord) error
type SensorLogRecord ¶
type SensorMeasurementRecord ¶
timescaleDB hypertable -- Does not support primary keys
type SensorRecord ¶
type SensorRecord struct { ID int `json:"id"` SerialNumber string `json:"serial_number"` SampleFrequency float64 `json:"sample_frequency"` }
func GetSensor ¶
func GetSensor() ([]SensorRecord, error)
func GetSensorBySerialNumber ¶
func GetSensorBySerialNumber(serialNumber string) (sensor SensorRecord, err error)
type TargetRecord ¶
TODO: add created_at and updated_at audit fields
func GetTarget ¶
func GetTarget() ([]TargetRecord, error)
Click to show internal directories.
Click to hide internal directories.