Documentation ¶
Index ¶
- func ConnectDB(connectionString string) (*mongo.Client, context.Context)
- func GetDatabase(client *mongo.Client, databaseName string) *mongo.Database
- func GetUsers(database *mongo.Database) *mongo.Collection
- func GetWebsites(database *mongo.Database) *mongo.Collection
- func InsertUser(connString string, dbName string, user User)
- func InsertUsers(connString string, dbName string, users []User)
- func InsertWebsite(connString string, dbName string, website Website)
- func InsertWebsites(connString string, dbName string, websites []Website)
- type User
- type Website
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectDB ¶
ConnectDB creates and returns a client connected by a connection string to mongoDB. Also checks the connection if everything is ok.
func GetDatabase ¶
GetDatabase returns the pointer to the database d(input).
func GetUsers ¶
func GetUsers(database *mongo.Database) *mongo.Collection
GetUsers returns the collection of users
func GetWebsites ¶
func GetWebsites(database *mongo.Database) *mongo.Collection
GetWebsites returns the collection of websites
func InsertUser ¶
InsertUser inserts an user into the collection users
func InsertUsers ¶
InsertUsers inserts into the collection users in database d(input) a slice of users inputted.
func InsertWebsite ¶
InsertWebsite inserts a website url into the collection websites
func InsertWebsites ¶
InsertWebsites inserts into the collection websites in database d(input) a slice of websites inputted.
Types ¶
Click to show internal directories.
Click to hide internal directories.