Documentation ¶
Overview ¶
Package database
Index ¶
- func DBinstance() *mongo.Client
- type DatabaseModule
- func (d DatabaseModule) AddUser(email string, name string, isAdmin bool) (*models.User, error)
- func (d DatabaseModule) CreateCollection(collectionName string)
- func (d DatabaseModule) FindUserByEmail(email string) (*models.User, error)
- func (d DatabaseModule) GetApps(email string) ([]models.App, error)
- func (d DatabaseModule) GetEmailCount(email string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DBinstance ¶
Types ¶
type DatabaseModule ¶
type DatabaseModule struct {
// contains filtered or unexported fields
}
DatabaseModule represents a struct that holds a mongoClient allowing for Collection and Database access with extra error handling.
func (DatabaseModule) CreateCollection ¶
func (d DatabaseModule) CreateCollection(collectionName string)
CreateCollection
func (DatabaseModule) FindUserByEmail ¶
func (d DatabaseModule) FindUserByEmail(email string) (*models.User, error)
FindUserByEmail returns a Models User and error. The models User represents the user if they were fond Erorr represents any errors encountered
func (DatabaseModule) GetApps ¶
func (d DatabaseModule) GetApps(email string) ([]models.App, error)
getApps returns a Go Array of Strings and an error The function checks the database for a set of apps that a particular user has access too.
func (DatabaseModule) GetEmailCount ¶
func (d DatabaseModule) GetEmailCount(email string) (int64, error)
GetEmailCount returns int64,error, the int represents the count of a certain email, and error if there was an error counting documents This function may become deprecated soon, was mainly used for testing and setting up API code.