bd

package
v0.0.0-...-7fb751a Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoCN = ConnectorBD()

MongoCN is an object to conect to DB

Functions

func CheckConnection

func CheckConnection() int

Checks connection ping to DB

func CheckUserAlreadyExists

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

CheckUserAlreadyExists checks if the database already contains a user registered with the input email address

func ConnectorBD

func ConnectorBD() *mongo.Client

connectorBD allows the connection to DB

func ConsultRelation

func ConsultRelation(t models.Relationship) (bool, error)

ConsultRelation checks the relationship between 2 users

func DeletePost

func DeletePost(ID string, UserID string) error

This function is for deleting posts

func DeleteRelationship

func DeleteRelationship(t models.Relationship) (bool, error)

DeleteRelationship deletes the relation in the database

func EncryptPassword

func EncryptPassword(pass string) (string, error)

EncryptPassword encrypts the user password for storage in Database

func InsertPost

func InsertPost(t models.RecordPost) (string, bool, error)

func InsertRegistration

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

This is the final stop with the db to insert the user data

func InsertRelationship

func InsertRelationship(t models.Relationship) (bool, error)

This func inserts the relationship

func ModifyRecord

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

modifies the record of the user

func ProfileLookup

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

ProfileLookup looks up for a profile in DB

func ReadAllUsers

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

ReadAllUsers reads the users registered in the system, if "R" is received in those who bring only those who are related to me

func ReadFollowersPosts

func ReadFollowersPosts(ID string, page int) ([]models.ReturnFollowersPosts, bool)

ReadFollowersPosts reads the posts of the followers

func ReadPosts

func ReadPosts(ID string, page int64) ([]*models.ReturnPost, bool)

ReadPosts reads the posts of a profile

func SearchProfile

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

SearchProfile finds the user based on the given ID as parameter

func TryLogin

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

TryLogin checks if the user exists in the database . If found it will compare the given password and password found in database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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