Documentation ¶
Overview ¶
Package mongodb is the package that holds the database logic for mongodb database
Package mongodb is the package that holds the database logic for mongodb database ¶
Package mongodb is the package that holds the database logic for mongodb database ¶
Package mongodb is the package that holds the database logic for mongodb database ¶
Package mongodb is the package that holds the database logic for mongodb database ¶
Package mongodb is the package that holds the database logic for mongodb database ¶
Package mongodb is the package that holds the database logic for mongodb database
Index ¶
- func NewDataContext() *application.DataContext
- type ConversationRepository
- func (cr ConversationRepository) AddMessage(conversationID string, message string, direction string) error
- func (cr ConversationRepository) CheckConversation(tripID string, userID string) (convoID string, err error)
- func (cr ConversationRepository) CheckConversationOwnership(conversationID string, userID string) (bool, error)
- func (cr ConversationRepository) GetConversation(tripID string, userID string) (*domain.Conversation, error)
- func (cr ConversationRepository) GetConversationByID(conversationID string) (*domain.Conversation, error)
- func (cr ConversationRepository) GetConversations(tripID string) ([]domain.Conversation, error)
- func (cr ConversationRepository) InitiateConversation(conversation domain.Conversation) error
- func (cr ConversationRepository) MarkConversationsRead(conversationID string, direction string) error
- func (cr ConversationRepository) UpdateApproval(conversationID string, supplierApprove string, requesterApprove string) error
- type GeographyRepository
- type HealthRepository
- type RequestRepository
- func (rr RequestRepository) AddRequest(request domain.Request) error
- func (rr RequestRepository) GetRequest(requestID string) (*domain.Request, error)
- func (rr RequestRepository) GetRequests(countryID string, origin string, destination string) (*[]domain.Request, error)
- func (rr RequestRepository) SetRequestStatus(requestID string, state int) error
- type TripRepository
- func (tr TripRepository) AddTrip(trip *domain.Trip) error
- func (tr TripRepository) GetConversationID(tripID string, userID string) (string, error)
- func (tr TripRepository) GetTripByID(tripID string) (*domain.TripDetail, error)
- func (tr TripRepository) GetTripCapacity(tripID string) (int, error)
- func (tr TripRepository) GetTrips(countryID string, origin, destination string) ([]*domain.Trip, error)
- func (tr TripRepository) SetTripCapacity(tripID string, capacity int) error
- type UserRepository
- func (ur UserRepository) ActivateUser(userID string) error
- func (ur UserRepository) AddConfirmationCode(userID string, confirmationCode string) error
- func (ur UserRepository) AddUser(u domain.User) (string, error)
- func (ur UserRepository) CheckConfirmationCode(userID string, confirmationCode string) error
- func (ur UserRepository) CheckUser(username string) (domain.User, error)
- func (ur UserRepository) CheckUserName(username string) (bool, error)
- func (ur UserRepository) GetUser(ID string) (domain.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDataContext ¶
func NewDataContext() *application.DataContext
NewDataContext returns a new mongoDB backed DataContext
Types ¶
type ConversationRepository ¶
type ConversationRepository struct {
// contains filtered or unexported fields
}
ConversationRepository represent a structure that will communicate to MongoDB to accomplish user related transactions
func (ConversationRepository) AddMessage ¶
func (cr ConversationRepository) AddMessage(conversationID string, message string, direction string) error
AddMessage adds a message to a conversation
func (ConversationRepository) CheckConversation ¶
func (cr ConversationRepository) CheckConversation(tripID string, userID string) (convoID string, err error)
CheckConversation checks if a conversation exists for current user a user under a trip
func (ConversationRepository) CheckConversationOwnership ¶
func (cr ConversationRepository) CheckConversationOwnership(conversationID string, userID string) (bool, error)
CheckConversationOwnership checks if a conversation's supplier is the current user
func (ConversationRepository) GetConversation ¶
func (cr ConversationRepository) GetConversation(tripID string, userID string) (*domain.Conversation, error)
GetConversation returns the conversation for a trip when the Requester is the user
func (ConversationRepository) GetConversationByID ¶
func (cr ConversationRepository) GetConversationByID(conversationID string) (*domain.Conversation, error)
GetConversationByID returns the conversation for a trip when the supplier is the user
func (ConversationRepository) GetConversations ¶
func (cr ConversationRepository) GetConversations(tripID string) ([]domain.Conversation, error)
GetConversations returns the conversation for a trip when the Supplier is the user, so it returns all conversations without their messages
func (ConversationRepository) InitiateConversation ¶
func (cr ConversationRepository) InitiateConversation(conversation domain.Conversation) error
InitiateConversation creates a new conversation for a trip and a user
func (ConversationRepository) MarkConversationsRead ¶
func (cr ConversationRepository) MarkConversationsRead(conversationID string, direction string) error
MarkConversationsRead marks all the messages of a conversation as read depending on the direction
func (ConversationRepository) UpdateApproval ¶
func (cr ConversationRepository) UpdateApproval(conversationID string, supplierApprove string, requesterApprove string) error
UpdateApproval updates the approval of a conversation
type GeographyRepository ¶
type GeographyRepository struct {
// contains filtered or unexported fields
}
GeographyRepository represent a structure that will communicate to MongoDB to accomplish geography related transactions
func (GeographyRepository) CheckBallotCity ¶
func (gr GeographyRepository) CheckBallotCity(countryID string, cityName string) (bool, error)
CheckBallotCity checks if the given city is a ballot city
func (GeographyRepository) GetCountries ¶
func (gr GeographyRepository) GetCountries() ([]domain.Country, error)
GetCountries returns the list of countries shy of their cities
func (GeographyRepository) GetCountry ¶
func (gr GeographyRepository) GetCountry(ID string) (domain.Country, error)
GetCountry returns one country with the given ID and its cities
type HealthRepository ¶
type HealthRepository struct {
// contains filtered or unexported fields
}
HealthRepository represent a structure that will communicate to MongoDB to accomplish health related transactions
func (HealthRepository) Ready ¶
func (hr HealthRepository) Ready() bool
Ready checks the mongodb connection
type RequestRepository ¶
type RequestRepository struct {
// contains filtered or unexported fields
}
RequestRepository is the repository for requests
func (RequestRepository) AddRequest ¶
func (rr RequestRepository) AddRequest(request domain.Request) error
AddRequest adds a request to the database
func (RequestRepository) GetRequest ¶
func (rr RequestRepository) GetRequest(requestID string) (*domain.Request, error)
GetRequest returns a request by its ID
func (RequestRepository) GetRequests ¶
func (rr RequestRepository) GetRequests(countryID string, origin string, destination string) (*[]domain.Request, error)
GetRequests returns all requests for a country, and if supplied filters by origin and destination
func (RequestRepository) SetRequestStatus ¶
func (rr RequestRepository) SetRequestStatus(requestID string, state int) error
SetRequestStatus sets the status of a request
type TripRepository ¶
type TripRepository struct {
// contains filtered or unexported fields
}
TripRepository represent a structure that will communicate to MongoDB to accomplish user related transactions
func (TripRepository) AddTrip ¶
func (tr TripRepository) AddTrip(trip *domain.Trip) error
AddTrip adds a new trip to the database
func (TripRepository) GetConversationID ¶
func (tr TripRepository) GetConversationID(tripID string, userID string) (string, error)
GetConversationID returns the conversation id of a trip and a user as requester
func (TripRepository) GetTripByID ¶
func (tr TripRepository) GetTripByID(tripID string) (*domain.TripDetail, error)
GetTripByID returns a trip from the database based on it id
func (TripRepository) GetTripCapacity ¶
func (tr TripRepository) GetTripCapacity(tripID string) (int, error)
GetTripCapacity returns the capacity of a trip
func (TripRepository) GetTrips ¶
func (tr TripRepository) GetTrips(countryID string, origin, destination string) ([]*domain.Trip, error)
GetTrips returns trips from the database
func (TripRepository) SetTripCapacity ¶
func (tr TripRepository) SetTripCapacity(tripID string, capacity int) error
SetTripCapacity updates the capacity of a trip
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository represent a structure that will communicate to MongoDB to accomplish user related transactions
func (UserRepository) ActivateUser ¶
func (ur UserRepository) ActivateUser(userID string) error
ActivateUser activates the user with the given ID
func (UserRepository) AddConfirmationCode ¶
func (ur UserRepository) AddConfirmationCode(userID string, confirmationCode string) error
AddConfirmationCode adds a new confirmation code to the database
func (UserRepository) AddUser ¶
func (ur UserRepository) AddUser(u domain.User) (string, error)
AddUser adds a new user to the database
func (UserRepository) CheckConfirmationCode ¶
func (ur UserRepository) CheckConfirmationCode(userID string, confirmationCode string) error
CheckConfirmationCode checks if the confirmation code is valid for the given user
func (UserRepository) CheckUser ¶
func (ur UserRepository) CheckUser(username string) (domain.User, error)
CheckUser checks the username if it matches any user from the database
func (UserRepository) CheckUserName ¶
func (ur UserRepository) CheckUserName(username string) (bool, error)
CheckUserName checks the username if it exists in the database
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package dao is the package that holds the database access objects
|
Package dao is the package that holds the database access objects |
Package mappers is the package that maps objects back and fort between dao and domain
|
Package mappers is the package that maps objects back and fort between dao and domain |