database

package
v0.0.0-...-4c323b9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBinstance

func DBinstance() *mongo.Client

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) AddUser

func (d DatabaseModule) AddUser(email string, name string, isAdmin bool) (*models.User, error)

AddUser

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.

Jump to

Keyboard shortcuts

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