mongodb

package
v0.0.0-...-84b4eae Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PortfolioChan []chan PortfolioData

Functions

This section is empty.

Types

type MongoDB

type MongoDB struct {
	Session       *mongo.Client
	Users         *mongo.Collection
	DeletedUsers  *mongo.Collection
	Income        *mongo.Collection
	DeletedIncome *mongo.Collection
	Cost          *mongo.Collection
	DeletedCost   *mongo.Collection
	IncomeHistory *mongo.Collection
	CostHistory   *mongo.Collection
}

func ConnectDB

func ConnectDB(cfg *utils.ServerConfig) (db *MongoDB)

ConnectDB will build connection to MongoDB Atlas

func (*MongoDB) CloseDB

func (db *MongoDB) CloseDB()

CloseDB will dissconnect to MongoDB

func (*MongoDB) CommitPortfolioVote

func (db *MongoDB) CommitPortfolioVote(ctx context.Context, in *chan PortfolioData, i int)

implement mongodb transaction for vote income

func (*MongoDB) CreateUserFromGoth

func (db *MongoDB) CreateUserFromGoth(user *goth.User) (*models.UserModel, error)

CreateUserFromGoth using data from goth to create user

func (*MongoDB) FindUserByAPIKey

func (db *MongoDB) FindUserByAPIKey(apiKey string) (*models.UserModel, error)

FindUserByAPIKey will find user related to the APIKey

func (*MongoDB) FindUserByJWT

func (db *MongoDB) FindUserByJWT(email string, provider string, userID string) (*models.UserModel, error)

FindUserByJWT will find user related to the JWT Token

type PortfolioData

type PortfolioData struct {
	Portfolio models.PortfolioModel
	Voter     primitive.ObjectID
	DB        *mongo.Collection
	Result    *chan []primitive.ObjectID
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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