Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logic ¶
type Logic struct { ID int `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"type:varchar(32);unique;not null"` Elems string `json:"elems" gorm:"type:text;not null"` SensorID int `json:"sensor_id" gorm:"not null"` Sensor Sensor `json:"sensor" gorm:"foreignKey:SensorID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
type LogicService ¶
type LogicService struct { ID int `json:"id" gorm:"primaryKey"` Addr string `json:"addr" gorm:"type:varchar(32);unique;not null"` TopicID int `json:"topic_id" gorm:"not null"` Topic Topic `json:"topic" gorm:"foreignKey:TopicID"` }
func (*LogicService) AfterCreate ¶
func (l *LogicService) AfterCreate(tx *gorm.DB) (err error)
logicService
func (*LogicService) BeforeDelete ¶
func (l *LogicService) BeforeDelete(tx *gorm.DB) (err error)
func (LogicService) TableName ¶
func (LogicService) TableName() string
type Node ¶
type Node struct { ID int `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"type:varchar(32);unique;not null"` LocLat float64 `json:"lat"` LocLon float64 `json:"lng"` SinkID int `json:"sink_id" gorm:"not null"` Sink Sink `json:"sink" gorm:"foreignKey:SinkID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Sensors []Sensor `json:"sensors" gorm:"many2many:has_sensors;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
type Sensor ¶
type Sensor struct { ID int `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"type:varchar(32);unique;not null"` SensorValues []SensorValue `json:"sensor_values" gorm:"foreignKey:SensorID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Nodes []Node `json:"nodes" gorm:"many2many:has_sensors;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Logics []Logic `json:"logics" gorm:"foreignKey:SensorID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
type SensorValue ¶
type SensorValue struct { SensorID int `json:"sensor_id" gorm:"primaryKey"` ValueName string `json:"value_name" gorm:"primaryKey;type:varchar(32)"` Index int `json:"index" gorm:"not null"` }
func (SensorValue) TableName ¶
func (SensorValue) TableName() string
type Sink ¶
type Sink struct { ID int `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"type:varchar(32);unique;not null"` Addr string `json:"addr" gorm:"type:varchar(32);not null"` TopicID int `json:"topic_id" gorm:"not null"` Topic Topic `json:"topic" gorm:"foreignKey:TopicID"` Nodes []Node `json:"nodes" gorm:"foreignKey:SinkID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
type Topic ¶
type Topic struct { ID int `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"type:varchar(32);unique;not null"` Partitions int `json:"partitions"` Replications int `json:"replications"` Sinks []Sink `json:"sinks" gorm:"foreignKey:TopicID"` LogicServices []LogicService `json:"logic_services" gorm:"foreignKey:TopicID"` }
Click to show internal directories.
Click to hide internal directories.