repository

package
v0.0.0-...-a852e11 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Station

type Station struct {
	ID           uint
	Type         string
	Street       string
	StreetNumber string
	Height       int
	Lon          float64
	Lat          float64
	Distance     float64
}

Station contains info about a station

type StationProvider

type StationProvider interface {
	GetAllStations() ([]Station, error)
	GetStationByID(id uint) (Station, error)
	GetNearbyStations(lat, lon float64, minStations int) ([]Station, error)
	GetStationStateByInterval(stationID int, start time.Time, duration time.Duration) ([]StationState, error)
	GetCurrentStationStateStationByID(stationID uint) (StationState, error)
}

StationProvider gives you a list of the nearby stations

func NewSQLStationProvider

func NewSQLStationProvider(db *sql.DB) StationProvider

NewSQLStationProvider returns a StationStateProvider that uses mysql to retrieve the information

type StationState

type StationState struct {
	ID, Bikes, Slots int
	Time             int64
}

StationState represents the state of a current station in a point in time

type StationStatePersister

type StationStatePersister interface {
	PersistCollection(collection.StationStateCollection) error
}

StationStatePersister takes the data from a collection.StationStateCollection and saves it to a persistent storage

func NewSQLStorage

func NewSQLStorage(db *sql.DB) StationStatePersister

NewSQLStorage returns a StationStaterPersister that will persist data in the database/sql passed to it

Jump to

Keyboard shortcuts

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