Categorygithub.com/syn-inc/server
modulepackage
2.0.0+incompatible
Repository: https://github.com/syn-inc/server.git
Documentation: pkg.go.dev

# README

Build Status golangci Go Report Card Maintainability codecov

SYN-server

Samples of requests:

To get data

Get data request consists of two parameters, path and key, e.g. /last?id=1. Path defines period and key - sensor id. Period might be only among these values - "last", "day", "week", "month", "year".

  • last - last value
  • day - average values for each of the last 24 hours
  • week - average values for each of the last 7 days
  • month - average values for each of the last 30 days
  • year - average values for each of the last 12 months

Available sensors

ID - DECRYPTION

  • 1 - Temperature, °C
  • 2 - Humidity, %
  • 3 - Pressure, hPa
  • 5 - Amount of luminous flux, lm

# Functions

ErrorResp return JSON in response body with 500 code as result of wrong request and error message which describes it.
IsGetOk test get-request.
IsSetOk Checks set-request for its correctness.

# Structs

Avg struct describes object for receiving average value for different time ranges.
Sensor struct describes basic object for work with database.