database

package
v0.0.0-...-99e36ab Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package database handles all database configuration

Index

Constants

This section is empty.

Variables

View Source
var (
	// Session represents a mgo connection.
	Session *mgo.Session
)

Functions

func FetchNumHours

func FetchNumHours(did string) string

FetchNumHours returns total number of hours of given users.

func FetchUser

func FetchUser(did string) error

FetchUser returns a singleton of users given discordID.

func NewUser

func NewUser(did, dit, guild, minutes string) (string, error)

NewUser returns a hex representation of the inputs ObjectID and insert errors into new database.

func UpdateUser

func UpdateUser(did, guildid, channelid string, minutes int) error

UpdateUser updates minutes studied to current users via discordID.

Types

type User

type User struct {
	ID             bson.ObjectId `bson:"_id,omitempty"`
	GUILDID        string        `bson:"guildid"`
	DiscordID      string        `bson:"discordid"`
	DiscordTag     string        `bson:"discordtag"`
	ChannelID      string        `bson:"channelid"`
	MinutesStudied int           `bson:"minutesstudied"`
}

User defined a user info with stats.

Jump to

Keyboard shortcuts

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