adapter

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KafkaToModel

func KafkaToModel(d *KafkaData) (model.KafkaData, error)

func LogicToModel

func LogicToModel(l *Logic) (model.Logic, error)

func LogicsToModels

func LogicsToModels(ll []Logic) []model.Logic

Types

type KafkaData

type KafkaData struct {
	SensorID  int       `json:"sensor_id"`
	NodeID    int       `json:"node_id"`
	Values    []float64 `json:"values"`
	Timestamp string    `json:"timestamp"`
}

type Logic

type Logic struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Elems    string `json:"elems"`
	SensorID int    `json:"sensor_id"`
}

func SensorToModel

func SensorToModel(s *Sensor) (model.Sensor, []Logic)

type LogicService

type LogicService struct {
	Addr  string `json:"addr"`
	Topic Topic  `json:"topic"`
}

type Node

type Node struct {
	ID      int      `json:"id"`
	Name    string   `json:"name"`
	LocLat  float64  `json:"lat"`
	LocLon  float64  `json:"lng"`
	SinkID  int      `json:"sink_id"`
	Sink    Sink     `json:"sink"`
	Sensors []Sensor `json:"sensors"`
}

type Sensor

type Sensor struct {
	ID           int           `json:"id"`
	Name         string        `json:"name"`
	SensorValues []SensorValue `json:"sensor_values"`
	Logics       []Logic       `json:"logics"`
}

func NodeToModel

func NodeToModel(n *Node, sn string) (model.Node, []Sensor)

type SensorValue

type SensorValue struct {
	SensorID  int    `json:"sensor_id"`
	ValueName string `json:"value_name"`
	Index     int    `json:"index"`
}

type Sink

type Sink struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Addr  string `json:"addr"`
	Nodes []Node `json:"nodes"`
}

type Topic

type Topic struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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