Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package common
import (
"encoding/json"
"github.com/pkg/errors"
)
// Location represents the location state of the car
type Location struct {
Altitude float64 `json:"altitude" redis:"altitude"`
Longitude float64 `json:"longitude" redis:"longitude"`
Latitude float64 `json:"latitude" redis:"latitude"`
Heading float64 `json:"-" redis:"heading"`
}
func (l *Location) Marshal() ([]byte, error) {
data, err := json.Marshal(*l)
return data, errors.WithStack(err)
}
func (l *Location) Unmarshal(data []byte) error {
err := json.Unmarshal(data, l)
return errors.WithStack(err)
}
func (it *Location) MarshalBinary() ([]byte, error) {
return json.Marshal(it)
}
func (it *Location) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, it)
}
type JSONCarLocation struct {
VIN string `json:"vin"`
Altitude float64 `json:"altitude"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Heading float64 `json:"heading"`
}