database
This commit is contained in:
41
src/udi/database/abstract_database.go
Normal file
41
src/udi/database/abstract_database.go
Normal file
@ -0,0 +1,41 @@
|
||||
package database
|
||||
|
||||
import "time"
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type Measurement struct {
|
||||
Time time.Time `gorm:"not null;primary_key"`
|
||||
Application string `gorm:"not null"`
|
||||
SensorType string `gorm:"not null"`
|
||||
Sensor string `gorm:"not null"`
|
||||
Variable string `gorm:"not null"`
|
||||
Unit string
|
||||
Value float32 `gorm:"not null"`
|
||||
Attributes map[string]string `gorm:"serializer:json;type:jsonb"`
|
||||
}
|
||||
|
||||
type Application struct {
|
||||
gorm.Model
|
||||
Label string `gorm:"not null"`
|
||||
Attributes map[string]string `gorm:"serializer:json;type:jsonb"`
|
||||
}
|
||||
|
||||
type SensorType struct {
|
||||
gorm.Model
|
||||
Label string `gorm:"not null"`
|
||||
Variable string `gorm:"not null"`
|
||||
Unit string
|
||||
Attributes map[string]string `gorm:"serializer:json;type:jsonb"`
|
||||
}
|
||||
|
||||
type Sensor struct {
|
||||
gorm.Model
|
||||
Label string `gorm:"not null"`
|
||||
ApplicationID int `gorm:"not null"`
|
||||
Application Application
|
||||
SensorTypeID int `gorm:"not null"`
|
||||
SensorType SensorType
|
||||
Attributes map[string]string `gorm:"serializer:json;type:jsonb"`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user