model

package
v0.0.0-...-5dfe684 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// Presents data type. Use constants: util.CarbonMonoxide, util.AirQuality, util.Raindrops, util.SoilMoisture.
	DataType string `json:"dataType"`
	// Sensor value.
	Value float32 `json:"value"`
	// When was the Value taken.
	Timestamp time.Time `json:"timestamp"`
}

Data is a struct used for serializing data to the database.

func (*Data) Convert

func (d *Data) Convert() *pb.Data

Convert Data to pb.Data.

func (*Data) ConvertToDC

func (d *Data) ConvertToDC() *pb.DataWithCategory

ConvertToDC converts Data to pb.DataWithCategory.

func (*Data) Equals

func (d *Data) Equals(b *Data) bool

Equals compares two Data structures.

func (Data) MarshalBinary

func (d Data) MarshalBinary() ([]byte, error)

func (*Data) String

func (d *Data) String() string

String returns Data fields in a string.

type DataResponse

type DataResponse struct {
	// Embedded Data struct.
	Data
	// Data.Value category. Check functions util.GetCategory.
	Category int `json:"category"`
}

DataResponse is a struct for serializing data from the database.

func (*DataResponse) Convert

func (dr *DataResponse) Convert() *pb.DataWithCategory

Convert DataResponse to pb.DataWithCategory.

func (*DataResponse) Equals

func (dr *DataResponse) Equals(b *DataResponse) bool

Equals compares two DataResponse structures.

func (DataResponse) MarshalBinary

func (dr DataResponse) MarshalBinary() ([]byte, error)

func (*DataResponse) String

func (dr *DataResponse) String() string

String returns DataResponse fields in a string.

Jump to

Keyboard shortcuts

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