db

package
v0.0.0-...-e7d5e60 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoCN = ConnectDB()

MongoCN is the connection object to the database.

Functions

func CheckConnection

func CheckConnection() bool

CheckConnection Function to check database connection.

func CheckFollow

func CheckFollow(t models.Follow) (bool, error)

CheckFollow Check for relation beetween two users in database.

func CheckIfUserAlreadyExists

func CheckIfUserAlreadyExists(email string) (models.User, bool, string)

CheckIfUserAlreadyExists Receive an email as a parameter and check if there is already a registered user with that email.

func ConnectDB

func ConnectDB() *mongo.Client

ConnectDB Function to connect to the database.

func DeleteFollow

func DeleteFollow(t models.Follow) (bool, error)

DeleteFollow Delete a specific relation.

func DeleteMsg

func DeleteMsg(ID string, UserID string) error

DeleteMsg delete a specific message.

func EncryptPassword

func EncryptPassword(pass string) (string, error)

EncryptPassword Function to encrypt the user's password.

func GetAllUsers

func GetAllUsers(ID string, page int64, search string, userType string) ([]*models.User, bool)

GetAllUsers Get all users who have a relation with me.

func GetFollowersMsg

func GetFollowersMsg(ID string, page int) ([]models.ReturnFollowersMsg, bool)

GetFollowersMsg Gets messages from my followers.

func GetMessages

func GetMessages(ID string, page int64) ([]*models.ReturnMsg, bool)

GetMessages Get all messages from a profile.

func GetProfile

func GetProfile(ID string) (models.User, error)

GetProfile Look for profile in database.

func InsertFollow

func InsertFollow(t models.Follow) (bool, error)

InsertFollow record relation in database.

func InsertMsg

func InsertMsg(t models.RecordMsg) (string, bool, error)

InsertMsg records a msg in database.

func InsertUser

func InsertUser(u models.User) (string, bool, error)

InsertUser Function to record the registration of a new user in the database.

func LoginAttemp

func LoginAttemp(email string, password string) (models.User, bool)

LoginAttemp Perform the login check in the database.

func ModifyProfile

func ModifyProfile(u models.User, ID string) (bool, error)

ModifyProfile modify the user's profile.

Types

This section is empty.

Jump to

Keyboard shortcuts

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