model

package
v0.0.0-...-35ec728 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

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;"`
}

func (*Logic) AfterCreate

func (l *Logic) AfterCreate(tx *gorm.DB) (err error)

logic

func (*Logic) BeforeDelete

func (l *Logic) BeforeDelete(tx *gorm.DB) (err error)

func (Logic) TableName

func (Logic) TableName() string

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;"`
}

func (*Node) AfterCreate

func (n *Node) AfterCreate(tx *gorm.DB) (err error)

node

func (*Node) BeforeDelete

func (n *Node) BeforeDelete(tx *gorm.DB) (err error)

func (Node) TableName

func (Node) TableName() string

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;"`
}

func (*Sensor) AfterCreate

func (s *Sensor) AfterCreate(tx *gorm.DB) (err error)

sensor

func (*Sensor) BeforeDelete

func (s *Sensor) BeforeDelete(tx *gorm.DB) (err error)

func (Sensor) TableName

func (Sensor) TableName() string

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;"`
}

func (*Sink) AfterCreate

func (s *Sink) AfterCreate(tx *gorm.DB) (err error)

sink

func (*Sink) BeforeDelete

func (s *Sink) BeforeDelete(tx *gorm.DB) (err error)

func (Sink) TableName

func (Sink) TableName() string

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"`
}

func (*Topic) BeforeDelete

func (t *Topic) BeforeDelete(tx *gorm.DB) (err error)

topic

func (Topic) TableName

func (Topic) TableName() string

Jump to

Keyboard shortcuts

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