scooter

package
v0.0.0-...-b412545 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVENT_TRIP_STARTED    string = "trip-started"
	EVENT_TRIP_ENDED      string = "trip-ended"
	EVENT_TRIP_UPDATED    string = "trip-update"
	EVENT_PERIODIC_UPDATE string = "periodic-update"
)
View Source
const (
	SCOOTER_STATUS_AVAILABLE  string = "available"
	SCOOTER_STATUS_INUSE      string = "inuse"
	SCOOTER_STATUS_COLLECTION string = "scooter-status"
)
View Source
const (
	SCOOTER_COLLECTION = "scooter"
)

Variables

This section is empty.

Functions

func NewScooterCreator

func NewScooterCreator(DB *mongo.Database) (scooteriface.ScooterCreator, error)

func NewStatusUpdater

func NewStatusUpdater(ScooterReserver scooteriface.ScooterReserver, DB *mongo.Database) (scooteriface.StatusUpdater, error)

Types

type ScooterCreator

type ScooterCreator struct {
	DB *mongo.Database
}

func (*ScooterCreator) Create

func (c *ScooterCreator) Create(ctx context.Context, scooter scootertype.Scooter) error

type ScooterFinder

type ScooterFinder struct {
	DB *mongo.Database
}

func NewScooterFinder

func NewScooterFinder(DB *mongo.Database) (*ScooterFinder, error)

func (*ScooterFinder) RectangularQuery

func (s *ScooterFinder) RectangularQuery(ctx context.Context, q struct {
	Status     string
	BottomLeft scootertype.Location
	TopRight   scootertype.Location
}) (*scootertype.RectangularQueryResult, error)

type ScooterReserver

type ScooterReserver struct {
	DB *mongo.Database
}

func NewScooterReserver

func NewScooterReserver(DB *mongo.Database) (*ScooterReserver, error)

func (*ScooterReserver) ReleaseScooter

func (s *ScooterReserver) ReleaseScooter(ctx context.Context, scooterID string) error

func (*ScooterReserver) ReserveScooter

func (s *ScooterReserver) ReserveScooter(ctx context.Context, scooterID string) (bool, error)

type StatusUpdater

type StatusUpdater struct {
	DB              *mongo.Database
	ScooterReserver scooteriface.ScooterReserver
}

func (*StatusUpdater) UpdateStatus

func (s *StatusUpdater) UpdateStatus(ctx context.Context, updateStatusInput struct {
	ScooterID string
	Timestamp string
	Latitude  string
	Longitude string
	EventType string
}) (*string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL