mongodb

package
v0.0.0-...-ab7c8e9 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

type MongoClient struct {
	DBURI string
	Conn  *mongo.Client
}

MongoClient is a struct to keep the DB connection and URI

var DBClient MongoClient

DBClient holds a client connection with the database

type TransportRepository

type TransportRepository struct {
	Conn *mongo.Client
}

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

Jump to

Keyboard shortcuts

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