models

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MongoDbPortEnvVar       = "MONGO_DB_PORT"
	MongoDbUserEnvVar       = "MONGO_DB_USER"
	MongoDbPasswordEnvVar   = "MONGO_DB_PASSWORD"
	MongoDbParamatersEnvVar = "MONGO_DB_PARAMETERS"
	MongoDbHostEnvVar       = "MONGO_DB_HOST"
	MongoCollection         = "Sessions"
	MongoDb                 = "SessionsDb"
	MongoDbDefaultPort      = "27017"
	MongoProtocol           = "mongodb://"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDbHandler

type MongoDbHandler struct {
	Collection *mongo.Collection
}

/ A struct to manage a MongoDb session database

func (*MongoDbHandler) AddSession

func (mongo *MongoDbHandler) AddSession(session Session) error

/ Adds a session to the database

func (*MongoDbHandler) GetAllSessions

func (mongo *MongoDbHandler) GetAllSessions() ([]Session, error)

/ Retrieves all sessions from the database

func (*MongoDbHandler) GetSession

func (mongo *MongoDbHandler) GetSession(uniqueName string) (Session, error)

/ Retrieve a session by the specific name

type Session

type Session struct {
	UniqueName   string `json:"uniqueName" bson:"_id"`
	Title        string `json:"title" bson:"title"`
	Subtitle     string `json:"subtitle" bson:"subtitle"`
	Description  string `json:"description" bson:"description"`
	PresenterId  string `json:"presenterId" bson:"presenterId"`
	SlideDeckUrl string `json:"slideDeckUrl" bson:"slideDeckUrl"`
	Location     string `json:"location" bson:"location"`
}

type SessionDatabaseHandler

type SessionDatabaseHandler interface {
	GetAllSessions() ([]Session, error)
	GetSession(string) (Session, error)
	AddSession(Session) error
}

/ Interface to interact with a session database.

func InitializeDatabaseHandler

func InitializeDatabaseHandler() SessionDatabaseHandler

/ Initializes the database to interact with the session database

Jump to

Keyboard shortcuts

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