Documentation
¶
Index ¶
- Constants
- Variables
- func Debug_InjectInvalidDatatForTracker(trk *Tracker, fieldName string)
- type Bootstraper
- type EventPublisher
- type Filter
- type Generator
- func (g *Generator) AddRoutes(ctx context.Context, trackerID types.ID, newRoutes []*gpsgen.Route) error
- func (g *Generator) AddSensor(ctx context.Context, trackerID types.ID, sensorConf *types.Sensor) error
- func (g *Generator) Close(ctx context.Context) error
- func (g *Generator) FindTracker(ctx context.Context, trackerID types.ID) (*Tracker, error)
- func (g *Generator) MoveToRoute(ctx context.Context, trackerID types.ID, routeIndex int) (types.Navigator, bool, error)
- func (g *Generator) MoveToRouteByID(ctx context.Context, trackerID types.ID, routeID types.ID) (types.Navigator, bool, error)
- func (g *Generator) MoveToSegment(ctx context.Context, trackerID types.ID, ...) (types.Navigator, bool, error)
- func (g *Generator) MoveToTrack(ctx context.Context, trackerID types.ID, routeIndex, trackIndex int) (types.Navigator, bool, error)
- func (g *Generator) MoveToTrackByID(ctx context.Context, trackerID, routeID, trackID types.ID) (types.Navigator, bool, error)
- func (g *Generator) NewTracker(ctx context.Context, opts *NewTrackerOptions) (*Tracker, error)
- func (g *Generator) RemoveRoute(ctx context.Context, trackerID types.ID, routeID types.ID) error
- func (g *Generator) RemoveSensor(ctx context.Context, trackerID types.ID, sensorID types.ID) error
- func (g *Generator) RemoveTracker(ctx context.Context, trackerID types.ID) error
- func (g *Generator) ResetNavigator(ctx context.Context, trackerID types.ID) error
- func (g *Generator) ResetRoutes(ctx context.Context, trackerID types.ID) (bool, error)
- func (g *Generator) ResumeTracker(ctx context.Context, trackerID types.ID) error
- func (g *Generator) RouteAt(ctx context.Context, trackerID types.ID, routeIndex int) (*gpsgen.Route, error)
- func (g *Generator) RouteByID(ctx context.Context, trackerID, routeID types.ID) (*gpsgen.Route, error)
- func (g *Generator) Routes(ctx context.Context, trackerID types.ID) ([]*gpsgen.Route, error)
- func (g *Generator) Run(ctx context.Context) error
- func (g *Generator) SearchTrackers(ctx context.Context, f Filter) (SearchResult, error)
- func (g *Generator) Sensors(ctx context.Context, trackerID types.ID) ([]*types.Sensor, error)
- func (g *Generator) ShutdownTracker(ctx context.Context, trackerID types.ID) error
- func (g *Generator) StartTracker(ctx context.Context, trackerID types.ID) error
- func (g *Generator) Stats(ctx context.Context) (item []StatsItem, err error)
- func (g *Generator) StopTracker(ctx context.Context, trackerID types.ID) error
- func (g *Generator) Sync(ctx context.Context, trackerID types.ID) error
- func (g *Generator) ToNextRoute(ctx context.Context, trackerID types.ID) (types.Navigator, bool, error)
- func (g *Generator) ToPrevRoute(ctx context.Context, trackerID types.ID) (types.Navigator, bool, error)
- func (g *Generator) TrackerState(ctx context.Context, trackerID types.ID) (*proto.Device, error)
- func (g *Generator) UpdateTracker(ctx context.Context, trackerID types.ID, opts UpdateTrackerOptions) error
- type NewTrackerOptions
- type Processes
- type Query
- type SearchResult
- type SensorSnapshot
- type Service
- type StatsItem
- type Storage
- type Tracker
- func (t *Tracker) AddRoute(route *gpsgen.Route) ([]*gpsgen.Route, error)
- func (t *Tracker) AddRoutes(newRoutes []*gpsgen.Route) ([]*gpsgen.Route, error)
- func (t *Tracker) AddSensor(newSensor *types.Sensor) error
- func (t *Tracker) Battery() types.Battery
- func (t *Tracker) Color() types.Color
- func (t *Tracker) CreatedAt() time.Time
- func (t *Tracker) Description() types.Description
- func (t *Tracker) Elevation() types.Elevation
- func (t *Tracker) FromSnapshot(snap *TrackerSnapshot) error
- func (t *Tracker) HasNoRoutes() bool
- func (t *Tracker) ID() types.ID
- func (t *Tracker) IsRunning() bool
- func (t *Tracker) IsTrackerOff() bool
- func (t *Tracker) Model() types.Model
- func (t *Tracker) NewProcess() (newProc *gpsgen.Device, err error)
- func (t *Tracker) NumRoutes() int
- func (t *Tracker) NumSensors() int
- func (t *Tracker) Offline() types.Offline
- func (t *Tracker) Properties() properties.Properties
- func (t *Tracker) RemoveRoute(routeID types.ID) error
- func (t *Tracker) RemoveSensorByID(id types.ID) error
- func (t *Tracker) ResetRoutes() error
- func (t *Tracker) ResetSensors()
- func (t *Tracker) ResetStatus()
- func (t *Tracker) ResumeProcess() (*gpsgen.Device, error)
- func (t *Tracker) RouteAt(index int) (*gpsgen.Route, error)
- func (t *Tracker) RouteByID(routeID types.ID) (route *gpsgen.Route, err error)
- func (t *Tracker) Routes() ([]*gpsgen.Route, error)
- func (t *Tracker) RunningAt() time.Time
- func (t *Tracker) Sensors() []*types.Sensor
- func (t *Tracker) ShutdownProcess(tracker *gpsgen.Device) error
- func (t *Tracker) SkipOffline() bool
- func (t *Tracker) Speed() types.Speed
- func (t *Tracker) Status() types.DeviceStatus
- func (t *Tracker) Stop() error
- func (t *Tracker) StoppedAt() time.Time
- func (t *Tracker) TakeSnapshot(snap *TrackerSnapshot)
- func (t *Tracker) UpdateInfo(opts UpdateTrackerOptions) (bool, error)
- func (t *Tracker) UpdatedAt() time.Time
- func (t *Tracker) UserID() types.CustomID
- type TrackerBuilder
- func (b *TrackerBuilder) Battery(battery types.Battery) *TrackerBuilder
- func (b *TrackerBuilder) Build() (*Tracker, error)
- func (b *TrackerBuilder) Color(color types.Color) *TrackerBuilder
- func (b *TrackerBuilder) CreatedAt(t time.Time) *TrackerBuilder
- func (b *TrackerBuilder) CustomID(id types.CustomID) *TrackerBuilder
- func (b *TrackerBuilder) Description(descr types.Description) *TrackerBuilder
- func (b *TrackerBuilder) Elevation(elevation types.Elevation) *TrackerBuilder
- func (b *TrackerBuilder) ID(id types.ID) *TrackerBuilder
- func (b *TrackerBuilder) Model(model types.Model) *TrackerBuilder
- func (b *TrackerBuilder) Offline(offline types.Offline) *TrackerBuilder
- func (b *TrackerBuilder) Props(p properties.Properties) *TrackerBuilder
- func (b *TrackerBuilder) RunningAt(t time.Time) *TrackerBuilder
- func (b *TrackerBuilder) SkipOffline(flag bool) *TrackerBuilder
- func (b *TrackerBuilder) Speed(speed types.Speed) *TrackerBuilder
- func (b *TrackerBuilder) Status(status types.DeviceStatus) *TrackerBuilder
- func (b *TrackerBuilder) StoppedAt(t time.Time) *TrackerBuilder
- func (b *TrackerBuilder) UpdatedAt(t time.Time) *TrackerBuilder
- type TrackerSnapshot
- type TrackerView
- type UpdateTrackerOptions
Constants ¶
const ( MaxRoutesPerTracker = 5 MaxTracksPerRoute = 10 MaxSegmentsPerTrack = 128 MaxSensorsPerDevice = 10 )
Variables ¶
var ( ErrTrackerIsAlreadyRunning = errors.New("gpsgend/generator: tracker is already running") ErrTrackerIsAlreadyStopped = errors.New("gpsgend/generator: tracker is already stopped") ErrTrackerHasNoRoutes = errors.New("gpsgend/generator: tracker has no routes") ErrNoRoutes = errors.New("gpsgend/generator: no routes for tracker") ErrNoSensor = errors.New("gpsgend/generator: no sensor for tracker") ErrTrackNotFound = errors.New("gpsgend/generator: track not found") ErrMaxNumRoutesExceeded = errors.New("gpsgend/generator: max number of routes exceeded") ErrMaxNumTracksExceeded = errors.New("gpsgend/generator: max number of tracks exceeded") ErrMaxNumSegmentsExceeded = errors.New("gpsgend/generator: max number of segments exceeded") ErrMaxNumSensorsExceeded = errors.New("gpsgend/generator: max number of sensors exceeded") ErrTrackerNotRunning = errors.New("gpsgend/generator: tracker not running") ErrTrackerNotPaused = errors.New("gpsgend/generator: tracker not paused") ErrTrackerOff = errors.New("gpsgend/generator: tracker is off") ErrParamsEmpty = errors.New("gpsgend/generator: params empty") ErrTrackerNotFound = errors.New("gpsgend/generator: tracker not found") ErrRouteNotFound = errors.New("gpsgend/generator: route not found") ErrSensorNotFound = errors.New("gpsgend/generator: sensor not found") ErrLoadingTracker = errors.New("gpsgend/generator: trackers loading error") ErrUnloadingTracker = errors.New("gpsgend/generator: trackers unloading error") ErrSensorAlreadyExists = errors.New("gpsgned/generator: sensor already exists") ErrNoTracker = errors.New("gpsgend/generator: no tracker") ErrInvalidParams = errors.New("gpsgend/generator: invalid params") ErrBrokenTracker = errors.New("gpsgend/generator: broken tracker data") ErrInvalidTrackerVersion = errors.New("gpsgend/generator: invalid tracker version") ErrStorageInsert = errors.New("gpsgend/generator: insert into storage") ErrStorageUpdate = errors.New("gpsgend/generator: update in storage") ErrStorageFind = errors.New("gpsgned/generator: find in storage") ErrStorageDelete = errors.New("gpsgned/generator: delete from storage") ErrStorageSearch = errors.New("gpsgned/generator: search in storage") )
Functions ¶
Types ¶
type Bootstraper ¶
type EventPublisher ¶
type EventPublisher interface { PublishTrackerCreated(ctx context.Context, trackerID types.ID) PublishTrackerRemoved(ctx context.Context, trackerID types.ID) PublishTrackerUpdated(ctx context.Context, trackerUD types.ID) PublishTrackerStarted(ctx context.Context, trackerID types.ID) PublishTrackerStopped(ctx context.Context, trackerID types.ID) PublishTrackerRoutesAdded(ctx context.Context, trackerID types.ID, routes []*gpsgen.Route) PublishTrackerRouteRemoved(ctx context.Context, trackerID, routeID types.ID) PublishTrackerRoutesReseted(ctx context.Context, trackerID types.ID) PublishTrackerSensorAdded(ctx context.Context, trackerID, sensorID types.ID) PublishTrackerSensorRemoved(ctx context.Context, trackerID, sensorID types.ID) PublishTrackerShutdowned(ctx context.Context, trackerID types.ID) PublishTrackerResumed(ctx context.Context, trackerID types.ID) }
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is a service for managing GPS trackers, routes, and related processes.
func New ¶
func New( s Storage, p Processes, b Bootstraper, q Query, ep EventPublisher, ) *Generator
New creates a new instance of the Generator.
func (*Generator) AddRoutes ¶
func (g *Generator) AddRoutes(ctx context.Context, trackerID types.ID, newRoutes []*gpsgen.Route) error
AddRoutes adds new routes to a tracker and updates related processes.
func (*Generator) AddSensor ¶
func (g *Generator) AddSensor( ctx context.Context, trackerID types.ID, sensorConf *types.Sensor, ) error
AddSensor adds a sensor to a tracker's list of sensors and updates related processes.
func (*Generator) FindTracker ¶
FindTracker retrieves a tracker from storage using its ID.
func (*Generator) MoveToRoute ¶
func (g *Generator) MoveToRoute(ctx context.Context, trackerID types.ID, routeIndex int) (types.Navigator, bool, error)
MoveToRoute moves the tracker's navigation to a specific route index and provides the updated navigation state.
func (*Generator) MoveToRouteByID ¶
func (g *Generator) MoveToRouteByID(ctx context.Context, trackerID types.ID, routeID types.ID) (types.Navigator, bool, error)
MoveToRouteByID moves the tracker's navigation to a specific route ID and provides the updated navigation state.
func (*Generator) MoveToSegment ¶
func (g *Generator) MoveToSegment(ctx context.Context, trackerID types.ID, routeIndex, trackIndex, segmentIndex int) (types.Navigator, bool, error)
MoveToSegment moves the tracker's navigation to a specific segment index within a route and provides the updated navigation state.
func (*Generator) MoveToTrack ¶
func (g *Generator) MoveToTrack(ctx context.Context, trackerID types.ID, routeIndex, trackIndex int) (types.Navigator, bool, error)
MoveToTrack moves the tracker's navigation to a specific track index within a route and provides the updated navigation state.
func (*Generator) MoveToTrackByID ¶
func (g *Generator) MoveToTrackByID(ctx context.Context, trackerID, routeID, trackID types.ID) (types.Navigator, bool, error)
MoveToTrackByID moves the tracker's navigation to a specific track ID within a route and provides the updated navigation state.
func (*Generator) NewTracker ¶
NewTracker creates a new tracker instance with the given options and inserts it into storage.
func (*Generator) RemoveRoute ¶
RemoveRoute removes a route from a tracker and updates related processes if needed.
func (*Generator) RemoveSensor ¶
func (g *Generator) RemoveSensor( ctx context.Context, trackerID types.ID, sensorID types.ID, ) error
RemoveSensor removes a sensor from a tracker's list of sensors and updates related processes.
func (*Generator) RemoveTracker ¶
RemoveTracker removes a tracker from storage and detaches it from any associated processes.
func (*Generator) ResetNavigator ¶
ResetNavigator resets the navigation state of a running tracker process.
func (*Generator) ResetRoutes ¶
ResetRoutes resets all routes for a tracker and updates related processes.
func (*Generator) ResumeTracker ¶
ResumeTracker resumes a tracker from a previously taken snapshot and attaches the process// Resume resumes a tracker from a previously taken snapshot and attaches the process.
func (*Generator) RouteAt ¶
func (g *Generator) RouteAt(ctx context.Context, trackerID types.ID, routeIndex int) (*gpsgen.Route, error)
RouteAt retrieves a route at a specific index for a tracker.
func (*Generator) RouteByID ¶
func (g *Generator) RouteByID(ctx context.Context, trackerID, routeID types.ID) (*gpsgen.Route, error)
RouteByID retrieves a route by its ID for a tracker.
func (*Generator) SearchTrackers ¶
SearchTrackers searches for trackers based on the provided filter. It returns a SearchResult and an error if the search operation fails.
func (*Generator) ShutdownTracker ¶
Shutdown shuts down a tracker, takes snapshots if needed, and detaches processes.
func (*Generator) StartTracker ¶
StartTracker starts a tracker process and attaches it.
func (*Generator) StopTracker ¶
StopTracker stops a tracker process and detaches it.
func (*Generator) ToNextRoute ¶
func (g *Generator) ToNextRoute(ctx context.Context, trackerID types.ID) (types.Navigator, bool, error)
ToNextRoute moves the tracker's navigation to the next route and provides the updated navigation state.
func (*Generator) ToPrevRoute ¶
func (g *Generator) ToPrevRoute(ctx context.Context, trackerID types.ID) (types.Navigator, bool, error)
ToPrevRoute moves the tracker's navigation to the previous route and provides the updated navigation state.
func (*Generator) TrackerState ¶
TrackerState retrieves the state of a running tracker process.
func (*Generator) UpdateTracker ¶
func (g *Generator) UpdateTracker( ctx context.Context, trackerID types.ID, opts UpdateTrackerOptions, ) error
UpdateTracker updates the information of a tracker, validates options, and manages related processes.
type NewTrackerOptions ¶
type NewTrackerOptions struct { Model *types.Model // Model of the device. Color *types.Color // Color of the device. UserID *types.CustomID // User ID associated with the device. Descr *types.Description // Description of the device. Props *properties.Properties SkipOffline bool // Skip offline mode. Offline types.Offline Elevation types.Elevation Battery types.Battery Speed types.Speed }
type Query ¶
type Query interface { // SearchTrackers searches for trackers based on the given filter criteria. SearchTrackers(ctx context.Context, f Filter) (SearchResult, error) // Stats returns generator statistics group by status. Stats(ctx context.Context) ([]StatsItem, error) }
Query defines an interface for querying tracker data.
type SearchResult ¶
type SearchResult struct { Trackers []TrackerView `json:"trackers"` Next int64 `json:"next"` }
SearchResult holds the result of a tracker search operation.
type SensorSnapshot ¶
type Service ¶
type Service interface { NewTracker(ctx context.Context, opts *NewTrackerOptions) (*Tracker, error) SearchTrackers(ctx context.Context, f Filter) (SearchResult, error) RemoveTracker(ctx context.Context, trackerID types.ID) error UpdateTracker(ctx context.Context, trackerID types.ID, opts UpdateTrackerOptions) error FindTracker(ctx context.Context, trackerID types.ID) (*Tracker, error) StartTracker(ctx context.Context, trackerID types.ID) error StopTracker(ctx context.Context, trackerID types.ID) error TrackerState(ctx context.Context, trackerID types.ID) (*proto.Device, error) AddRoutes(ctx context.Context, trackerID types.ID, newRoutes []*gpsgen.Route) error RemoveRoute(ctx context.Context, trackerID types.ID, routeID types.ID) error Routes(ctx context.Context, trackerID types.ID) ([]*gpsgen.Route, error) RouteAt(ctx context.Context, trackerID types.ID, routeIndex int) (*gpsgen.Route, error) RouteByID(ctx context.Context, trackerID, routeID types.ID) (*gpsgen.Route, error) ResetRoutes(ctx context.Context, trackerID types.ID) (bool, error) ToNextRoute(ctx context.Context, trackerID types.ID) (types.Navigator, bool, error) ToPrevRoute(ctx context.Context, trackerID types.ID) (types.Navigator, bool, error) MoveToRoute(ctx context.Context, trackerID types.ID, routeIndex int) (types.Navigator, bool, error) MoveToRouteByID(ctx context.Context, trackerID types.ID, routeID types.ID) (types.Navigator, bool, error) MoveToTrack(ctx context.Context, trackerID types.ID, routeIndex, trackIndex int) (types.Navigator, bool, error) MoveToTrackByID(ctx context.Context, trackerID, routeID, trackID types.ID) (types.Navigator, bool, error) MoveToSegment(ctx context.Context, trackerID types.ID, routeIndex, trackIndex, segmentIndex int) (types.Navigator, bool, error) AddSensor(ctx context.Context, trackerID types.ID, sensor *types.Sensor) error RemoveSensor(ctx context.Context, trackerID types.ID, sensorID types.ID) error Sensors(ctx context.Context, trackerID types.ID) ([]*types.Sensor, error) ShutdownTracker(ctx context.Context, trackerID types.ID) error ResumeTracker(ctx context.Context, trackerID types.ID) error Stats(ctx context.Context) ([]StatsItem, error) Sync(ctx context.Context, trackerID types.ID) error }
type Storage ¶
type Storage interface { // Find retrieves a Tracker based on the provided trackerID from the storage. // If the Tracker is found, it is returned along with a nil error. // If the Tracker is not found, nil is returned along with an error describing the situation. Find(ctx context.Context, trackerID types.ID) (*Tracker, error) // Insert adds a new Tracker to the storage. // Returns an error if the insertion process fails. Insert(ctx context.Context, t *Tracker) error // Delete removes a Tracker from the storage based on the provided trackerID. // Returns an error if the deletion process fails. Delete(ctx context.Context, trackerID types.ID) error // Update updates the information of an existing Tracker in the storage. // Returns an error if the update process fails. Update(ctx context.Context, t *Tracker) error }
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker represents a GPS tracker device with various properties and capabilities.
func (*Tracker) CreatedAt ¶
CreatedAt returns the timestamp indicating when the tracker was created.
func (*Tracker) Description ¶
func (t *Tracker) Description() types.Description
Description returns the description of the tracker.
func (*Tracker) FromSnapshot ¶
func (t *Tracker) FromSnapshot(snap *TrackerSnapshot) error
func (*Tracker) HasNoRoutes ¶
HasNoRoutes checks if the tracker has no routes.
func (*Tracker) IsTrackerOff ¶
IsTrackerOff checks if the tracker is in a paused state.
func (*Tracker) NewProcess ¶
NewProcess creates a new GPS device process for the tracker.
func (*Tracker) NumSensors ¶
NumSensors returns the number of sensors associated with the tracker.
func (*Tracker) Properties ¶
func (t *Tracker) Properties() properties.Properties
Properties returns the custom properties associated with the tracker.
func (*Tracker) RemoveRoute ¶
RemoveRoute removes a route from the tracker by route ID.
func (*Tracker) RemoveSensorByID ¶
RemoveSensorByID removes a sensor from the tracker by sensor ID.
func (*Tracker) ResetRoutes ¶
ResetRoutes removes all routes from the tracker.
func (*Tracker) ResetSensors ¶
func (t *Tracker) ResetSensors()
func (*Tracker) ResetStatus ¶
func (t *Tracker) ResetStatus()
ResetStatus resets the tracker's status to stopped.
func (*Tracker) ResumeProcess ¶
ResumeProcess resumes a paused tracker's process with the provided GPS device state.
func (*Tracker) RunningAt ¶
RunningAt returns the timestamp indicating when the tracker's GPS process started running.
func (*Tracker) ShutdownProcess ¶
ShutdownProcess saves the current GPS device state and pauses the tracker's process.
func (*Tracker) SkipOffline ¶
SkipOffline returns whether skipping offline data is enabled for the tracker.
func (*Tracker) Status ¶
func (t *Tracker) Status() types.DeviceStatus
Status returns the status of the tracker.
func (*Tracker) StoppedAt ¶
StoppedAt returns the timestamp indicating when the tracker's GPS process was stopped.
func (*Tracker) TakeSnapshot ¶
func (t *Tracker) TakeSnapshot(snap *TrackerSnapshot)
func (*Tracker) UpdateInfo ¶
func (t *Tracker) UpdateInfo(opts UpdateTrackerOptions) (bool, error)
UpdateInfo updates the tracker's information with the provided options.
type TrackerBuilder ¶
type TrackerBuilder struct {
// contains filtered or unexported fields
}
func NewTrackerBuilder ¶
func NewTrackerBuilder() *TrackerBuilder
func (*TrackerBuilder) Battery ¶
func (b *TrackerBuilder) Battery(battery types.Battery) *TrackerBuilder
func (*TrackerBuilder) Build ¶
func (b *TrackerBuilder) Build() (*Tracker, error)
func (*TrackerBuilder) Color ¶
func (b *TrackerBuilder) Color(color types.Color) *TrackerBuilder
func (*TrackerBuilder) CreatedAt ¶
func (b *TrackerBuilder) CreatedAt(t time.Time) *TrackerBuilder
func (*TrackerBuilder) CustomID ¶
func (b *TrackerBuilder) CustomID(id types.CustomID) *TrackerBuilder
func (*TrackerBuilder) Description ¶
func (b *TrackerBuilder) Description(descr types.Description) *TrackerBuilder
func (*TrackerBuilder) Elevation ¶
func (b *TrackerBuilder) Elevation(elevation types.Elevation) *TrackerBuilder
func (*TrackerBuilder) ID ¶
func (b *TrackerBuilder) ID(id types.ID) *TrackerBuilder
func (*TrackerBuilder) Model ¶
func (b *TrackerBuilder) Model(model types.Model) *TrackerBuilder
func (*TrackerBuilder) Offline ¶
func (b *TrackerBuilder) Offline(offline types.Offline) *TrackerBuilder
func (*TrackerBuilder) Props ¶
func (b *TrackerBuilder) Props(p properties.Properties) *TrackerBuilder
func (*TrackerBuilder) RunningAt ¶
func (b *TrackerBuilder) RunningAt(t time.Time) *TrackerBuilder
func (*TrackerBuilder) SkipOffline ¶
func (b *TrackerBuilder) SkipOffline(flag bool) *TrackerBuilder
func (*TrackerBuilder) Speed ¶
func (b *TrackerBuilder) Speed(speed types.Speed) *TrackerBuilder
func (*TrackerBuilder) Status ¶
func (b *TrackerBuilder) Status(status types.DeviceStatus) *TrackerBuilder
func (*TrackerBuilder) StoppedAt ¶
func (b *TrackerBuilder) StoppedAt(t time.Time) *TrackerBuilder
func (*TrackerBuilder) UpdatedAt ¶
func (b *TrackerBuilder) UpdatedAt(t time.Time) *TrackerBuilder
type TrackerSnapshot ¶
type TrackerSnapshot struct { ID string `json:"trackerId" bson:"tracker_id,omitempty"` CustomID string `json:"customId" bson:"custom_id"` Status struct { ID int `json:"id" bson:"id"` Name string `json:"name" bson:"name"` } `json:"status" bson:"status"` Model string `json:"model" bson:"model"` Color string `json:"color" bson:"color"` Descr string `json:"descr" bson:"descr"` Offline struct { Min int `json:"min" bson:"min"` Max int `json:"max" bson:"max"` } `json:"offline" bson:"offline"` Elevation struct { Min float64 `json:"min" bson:"min"` Max float64 `json:"max" bson:"max"` Amplitude int `json:"amplitude" bson:"amplitude"` Mode int `json:"mode" bson:"mode"` } `json:"elevation" bson:"elevation"` Battery struct { Min float64 `json:"min" bson:"min"` Max float64 `json:"max" bson:"max"` ChargeTime float64 `json:"chargeTime" bson:"charge_time"` } `json:"battery" bson:"battery"` Speed struct { Min float64 `json:"min" bson:"min"` Max float64 `json:"max" bson:"max"` Amplitude int `json:"amplitude" bson:"amplitude"` } `json:"speed" bson:"speed"` Props properties.Properties `json:"props,omitempty" bson:"props"` Sensors []SensorSnapshot `json:"sensors" bson:"sensors"` NumSensors int `json:"numSensors" bson:"num_sensors"` NumRoutes int `json:"numRoutes" bson:"num_routes"` SkipOffline bool `json:"skipOffline" bson:"skip_offline"` Snapshot []byte `json:"-" bson:"snapshot"` Routes []byte `json:"-" bson:"routes"` CreatedAt int64 `json:"createdAt" bson:"created_at"` UpdatedAt int64 `json:"updatedAt" bson:"updated_at"` RunningAt int64 `json:"runningAt" bson:"running_at"` StoppedAt int64 `json:"stoppedAt" bson:"stopped_at"` Version int `json:"version" bson:"version"` }
type TrackerView ¶
type TrackerView struct { ID string `json:"trackerId" bson:"tracker_id"` CustomID string `json:"customId" bson:"custom_id"` Status struct { ID int `json:"id" bson:"id"` Name string `json:"name" bson:"name"` } `json:"status" bson:"status"` Model string `json:"model" bson:"model"` Color string `json:"color" bson:"color"` Descr string `json:"descr" bson:"descr"` Offline struct { Min int `json:"min" bson:"min"` Max int `json:"max" bson:"max"` } `json:"offline" bson:"offline"` Elevation struct { Min float64 `json:"min" bson:"min"` Max float64 `json:"max" bson:"max"` Amplitude int `json:"amplitude" bson:"amplitude"` Mode int `json:"mode" bson:"mode"` } `json:"elevation" bson:"elevation"` Battery struct { Min float64 `json:"min" bson:"min"` Max float64 `json:"max" bson:"max"` ChargeTime float64 `json:"chargeTime" bson:"charge_time"` } `json:"battery" bson:"battery"` Speed struct { Min float64 `json:"min" bson:"min"` Max float64 `json:"max" bson:"max"` Amplitude int `json:"amplitude" bson:"amplitude"` } `json:"speed" bson:"speed"` Props properties.Properties `json:"props,omitempty" bson:"props,omitempty"` NumSensors int `json:"numSensors" bson:"num_sensors"` NumRoutes int `json:"numRoutes" bson:"num_routes"` SkipOffline bool `json:"skipOffline" bson:"skip_offline"` CreatedAt int64 `json:"createdAt,omitempty" bson:"created_at"` UpdatedAt int64 `json:"updatedAt,omitempty" bson:"updated_at"` RunningAt int64 `json:"runningAt,omitempty" bson:"running_at"` StoppedAt int64 `json:"stoppedAt,omitempty" bson:"stopped_at"` }
TrackerView provides a structured view of tracker information for display or transmission.