mirror of
https://github.com/parkan/go-hauk.git
synced 2026-05-08 16:47:46 +02:00
add data models
This commit is contained in:
25
model/point.go
Normal file
25
model/point.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
type Point struct {
|
||||
IV string `json:"iv,omitempty"`
|
||||
Lat float64 `json:"lat"`
|
||||
Lon float64 `json:"lon"`
|
||||
Time float64 `json:"time"`
|
||||
Provider int `json:"prv"`
|
||||
Accuracy *float64 `json:"acc,omitempty"`
|
||||
Speed *float64 `json:"spd,omitempty"`
|
||||
}
|
||||
|
||||
func (p Point) ToArray(encrypted bool) []any {
|
||||
if encrypted {
|
||||
return []any{p.IV, p.Lat, p.Lon, p.Time, p.Provider, p.Accuracy, p.Speed}
|
||||
}
|
||||
return []any{p.Lat, p.Lon, p.Time, p.Provider, p.Accuracy, p.Speed}
|
||||
}
|
||||
|
||||
func (p Point) TimeIndex(encrypted bool) int {
|
||||
if encrypted {
|
||||
return 3
|
||||
}
|
||||
return 2
|
||||
}
|
||||
Reference in New Issue
Block a user