Documentation ¶
Index ¶
- Variables
- func ConnectToMongoDB(db *mgo.Session, pool *dockertest.Pool, containerResource *dockertest.Resource) (*mgo.Session, *dockertest.Pool, *dockertest.Resource)
- type CarShareStorage
- func (s *CarShareStorage) Delete(id string, context api2go.APIContexter) error
- func (s CarShareStorage) GetAll(userID string, ctx api2go.APIContexter) ([]model.CarShare, error)
- func (s CarShareStorage) GetOne(id string, ctx api2go.APIContexter) (model.CarShare, error)
- func (s *CarShareStorage) Insert(c model.CarShare, context api2go.APIContexter) (string, error)
- func (s *CarShareStorage) Update(c model.CarShare, context api2go.APIContexter) error
- type TripStorage
- func (s *TripStorage) Delete(id string, context api2go.APIContexter) error
- func (s *TripStorage) GetAll(context api2go.APIContexter) ([]model.Trip, error)
- func (s *TripStorage) GetLatest(carShareID string, context api2go.APIContexter) (model.Trip, error)
- func (s *TripStorage) GetOne(id string, context api2go.APIContexter) (model.Trip, error)
- func (s *TripStorage) Insert(t model.Trip, context api2go.APIContexter) (string, error)
- func (s *TripStorage) Update(t model.Trip, context api2go.APIContexter) error
- type UserStorage
- func (s *UserStorage) Delete(id string, context api2go.APIContexter) error
- func (s UserStorage) GetAll(context api2go.APIContexter) ([]model.User, error)
- func (s UserStorage) GetByFirebaseUID(firebaseUID string, context api2go.APIContexter) (model.User, error)
- func (s UserStorage) GetOne(id string, context api2go.APIContexter) (model.User, error)
- func (s *UserStorage) Insert(u model.User, context api2go.APIContexter) (string, error)
- func (s *UserStorage) Update(u model.User, context api2go.APIContexter) error
Constants ¶
This section is empty.
Variables ¶
var ( // UsersColl mongo collection name for users UsersColl = "users" // TripsColl mongo collection name for trips TripsColl = "trips" 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") )CarShareDB = "carshare"
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 ¶
func (s CarShareStorage) GetOne(id string, ctx api2go.APIContexter) (model.CarShare, error)
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 {
}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