model

package
v0.0.0-...-c42e73f Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	UUID    string   `json:"uuid" gorm:"primary_key;type:char(20);not null;"`
	Name    string   `json:"name" gorm:"type:varchar(32);unique;not null"`
	Group   string   `json:"location" gorm:"type:varchar(64)"`
	LocLat  float64  `json:"lat"`
	LocLon  float64  `json:"lon"`
	SinkID  uint     `json:"sink_id" gorm:"not null"`
	Sensors []Sensor `json:"sensors" gorm:"foreignkey:UUID"`
}

func NewNode

func NewNode(name, grp string, lat, lon float64, sinkID uint) Node

func (Node) TableName

func (Node) TableName() string

type NodeSensor

type NodeSensor struct {
	NodeUUID   string `gorm:"primary_key;type:char(20)"`
	SensorUUID string `gorm:"primary_key;type:char(20)"`
}

func (NodeSensor) TableName

func (NodeSensor) TableName() string

type Sensor

type Sensor struct {
	UUID      string        `json:"uuid" gorm:"primary_key;type:char(20);not null;"`
	Name      string        `json:"name" gorm:"type:varchar(32);unique;not null"`
	ValueList []SensorValue `json:"value_list" gorm:"foreignkey:SensorUUID"`
}

func NewSensor

func NewSensor(name string) Sensor

func (Sensor) TableName

func (Sensor) TableName() string

type SensorValue

type SensorValue struct {
	SensorUUID string `json:"sensor_uuid" gorm:"primary_key;type:char(20);not null"`
	ValueName  string `json:"value_name" gorm:"primary_key;type:varchar(32);not null"`
	Index      int    `json:"index" gorm:"not null"`
}

func (SensorValue) TableName

func (SensorValue) TableName() string

type Sink

type Sink struct {
	ID       uint   `json:"id" gorm:"primary_key"`
	Name     string `json:"name" gorm:"type:varchar(32);unique"`
	Location string `json:"location" gorm:"type:varchar(64)"`
	IP       string `json:"ip" gorm:"type:varchar(16);not null"`
	Nodes    []Node `json:"nodes" gorm:"foreignkey:SinkID"`
}

func (*Sink) CheckIP

func (s *Sink) CheckIP() error

func (Sink) TableName

func (Sink) TableName() string

Jump to

Keyboard shortcuts

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