Documentation ¶
Index ¶
- Constants
- type MongoClient
- type TransportRepository
- func (repo TransportRepository) Get(id string) (*domain.Transport, error)
- func (repo TransportRepository) GetAll() ([]*domain.Transport, error)
- func (repo TransportRepository) Save(transport *domain.Transport) (string, error)
- func (repo TransportRepository) UpdatePosition(transportID string, newPosition *domain.Position) (*domain.Transport, error)
Constants ¶
View Source
const CollectionName = "transports"
CollectionName in MongoDB
View Source
const DatabaseName = "geolocation"
DatabaseName in MongoDB
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoClient ¶
MongoClient is a struct to keep the DB connection and URI
var DBClient MongoClient
DBClient holds a client connection with the database
type TransportRepository ¶
TransportRepository is the MongoDB implementation of the interface domain.TransportRepository
func (TransportRepository) Get ¶
func (repo TransportRepository) Get(id string) (*domain.Transport, error)
Get a Transport by ID
func (TransportRepository) GetAll ¶
func (repo TransportRepository) GetAll() ([]*domain.Transport, error)
GetAll Transports
func (TransportRepository) Save ¶
func (repo TransportRepository) Save(transport *domain.Transport) (string, error)
Save stores a Transport to the Database and returns the new Transport ID
func (TransportRepository) UpdatePosition ¶
func (repo TransportRepository) UpdatePosition(transportID string, newPosition *domain.Position) (*domain.Transport, error)
UpdatePosition updates the position of the transport with the given ID
Click to show internal directories.
Click to hide internal directories.