mongodb

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CarShareDB mongo database name
	CarShareDB = "carshare"

	// UsersColl mongo collection name for users
	UsersColl = "users"

	// TripsColl mongo collection name for trips
	TripsColl = "trips"

	// CarSharesColl mongo collection name for car shares
	CarSharesColl = "carshares"

	// ErrorNoDBSessionInContext request context is missing database session
	ErrorNoDBSessionInContext = errors.New("Error retrieving mongodb session from context")

	// ErrorInvalidDBSession unable to case database session in request context as mgo.Session
	ErrorInvalidDBSession = errors.New("Error asserting type of mongodb session from context")
)

Functions

func ConnectToMongoDB

func ConnectToMongoDB(db *mgo.Session, pool *dockertest.Pool, containerResource *dockertest.Resource) (*mgo.Session, *dockertest.Pool, *dockertest.Resource)

ConnectToMongoDB spin up a mongodb for integration tests

Types

type CarShareStorage

type CarShareStorage struct{}

CarShareStorage stores all car shares

func (*CarShareStorage) Delete

func (s *CarShareStorage) Delete(id string, context api2go.APIContexter) error

Delete to satisfy storage.CarShareStoreage interface

func (CarShareStorage) GetAll

func (s CarShareStorage) GetAll(userID string, ctx api2go.APIContexter) ([]model.CarShare, error)

GetAll to satisfy storage.CarShareStorage interface

func (CarShareStorage) GetOne

GetOne to satisfy storage.CarShareStoreage interface

func (*CarShareStorage) Insert

func (s *CarShareStorage) Insert(c model.CarShare, context api2go.APIContexter) (string, error)

Insert to satisfy storage.CarShareStoreage interface

func (*CarShareStorage) Update

func (s *CarShareStorage) Update(c model.CarShare, context api2go.APIContexter) error

Update to satisfy storage.CarShareStoreage interface

type TripStorage

type TripStorage struct {
	CarshareStorage *CarShareStorage
}

TripStorage a place to store car share trips

func (*TripStorage) Delete

func (s *TripStorage) Delete(id string, context api2go.APIContexter) error

Delete to satisfy storage.TripStorage interface

func (*TripStorage) GetAll

func (s *TripStorage) GetAll(context api2go.APIContexter) ([]model.Trip, error)

GetAll to satisfy storage.TripStorage interface

func (*TripStorage) GetLatest

func (s *TripStorage) GetLatest(carShareID string, context api2go.APIContexter) (model.Trip, error)

GetLatest to satisfy storage.TripStorage interface

func (*TripStorage) GetOne

func (s *TripStorage) GetOne(id string, context api2go.APIContexter) (model.Trip, error)

GetOne to satisfy storage.TripStorage interface

func (*TripStorage) Insert

func (s *TripStorage) Insert(t model.Trip, context api2go.APIContexter) (string, error)

Insert to satisfy storage.TripStorage interface

func (*TripStorage) Update

func (s *TripStorage) Update(t model.Trip, context api2go.APIContexter) error

Update to satisfy storage.TripStorage interface

type UserStorage

type UserStorage struct{}

UserStorage stores all users

func (*UserStorage) Delete

func (s *UserStorage) Delete(id string, context api2go.APIContexter) error

Delete to satisfy storage.UserStorage interface

func (UserStorage) GetAll

func (s UserStorage) GetAll(context api2go.APIContexter) ([]model.User, error)

GetAll to satisfy storage.UserStorage interface

func (UserStorage) GetByFirebaseUID

func (s UserStorage) GetByFirebaseUID(firebaseUID string, context api2go.APIContexter) (model.User, error)

GetByFirebaseUID to satisfy storage.UserStoreage interface

func (UserStorage) GetOne

func (s UserStorage) GetOne(id string, context api2go.APIContexter) (model.User, error)

GetOne to satisfy storage.UserStorage interface

func (*UserStorage) Insert

func (s *UserStorage) Insert(u model.User, context api2go.APIContexter) (string, error)

Insert to satisfy storage.UserStorage interface

func (*UserStorage) Update

func (s *UserStorage) Update(u model.User, context api2go.APIContexter) error

Update to satisfy storage.UserStorage interface

Jump to

Keyboard shortcuts

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