util

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

Documentation

Index

Constants

View Source
const (
	// CarbonMonoxide constant.
	CarbonMonoxide = "CARBON_MONOXIDE"
	// AirQuality constant.
	AirQuality = "AIR_QUALITY"
	// Raindrops constant.
	Raindrops = "RAINDROPS"
	// SoilMoisture constant.
	SoilMoisture = "SOIL_MOISTURE"

	// EnvTestFilePath path for the file 'test.env'.
	EnvTestFilePath = "../env/test.env"
)

Variables

This section is empty.

Functions

func Equals

func Equals(a, b *pb.DataWithCategory) bool

Equals compares two pb.DataWithCategory structures.

func GetCategory

func GetCategory(value int, dataType string) int

GetCategory returns category for a specific dataType.

func LoadTLS

LoadTLS loads TLS certificate.

func MapAir

func MapAir(value int) int

MapAir quality value to 6 categories, with 1 being the best.

func MapCO2

func MapCO2(value int) int

MapCO2 value to 7 categories, with 1 being the best.

func MapValue

func MapValue(x float64, inMin float64, inMax float64, outMin float64, outMax float64) int

MapValue from one range to another.

func RateLimit

func RateLimit(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

RateLimit limit request rate - 10 request per second.

Types

This section is empty.

Jump to

Keyboard shortcuts

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