Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(adapter DatabaseAdapter) http.HandlerFunc
Handler parses measurement from HTTP body and saves it to database
Types ¶
type DatabaseAdapter ¶
type DatabaseAdapter interface {
Save(*Measurement) error
}
type Measurement ¶
type Measurement struct { Tags []struct { AccelX float32 `json:"accelX"` AccelY float32 `json:"accelY"` AccelZ float32 `json:"accelZ"` DataFormat int `json:"dataFormat"` DefaultBackground int `json:"defaultBackground"` Favorite bool `json:"favorite"` Humidity float32 `json:"humidity"` ID string `json:"id"` MeasurementSequenceNumber int `json:"measurementSequenceNumber"` MovementCounter int `json:"movementCounter"` Name string `json:"name,omitempty"` Pressure float32 `json:"pressure"` RSSI int `json:"rssi"` Temperature float32 `json:"temperature"` TXPower float32 `json:"txPower"` UpdateAt string `json:"updateAt"` Voltage float32 `json:"voltage"` RawDataBlob struct { // contains filtered or unexported fields } `json:"rawDataBlob"` } `json:"tags"` BatteryLevel int `json:"batteryLevel"` DeviceID string `json:"deviceId"` EventID string `json:"eventId"` Location struct { Accuracy float32 `json:"accuracy"` Latitude float32 `json:"latitude"` Longitude float32 `json:"longitude"` } `json:"location"` Time string `json:"time"` }
func Parse ¶
func Parse(b []byte) (*Measurement, error)
Click to show internal directories.
Click to hide internal directories.