Documentation
¶
Index ¶
- func AddServerSpecs(db *gorm.DB, gameSession *GameSession) error
- func AuthLogin(db *gorm.DB, user *Users) (string, error)
- func CheckIfBarrierAddressExists(db *gorm.DB, barrierIP string) (bool, error)
- func CheckIfEmailAndPasswordMatch(db *gorm.DB, emailID string, Password string) (string, error)
- func CheckIfEmailExits(db *gorm.DB, Email string) error
- func CheckIfGameSessionIsActiveOrRemove(gorm *gorm.DB)
- func Connect() (*gorm.DB, error)
- func CreateTables(db *gorm.DB) (*gorm.DB, error)
- func GetUserID(db *gorm.DB, emailID string) (string, error)
- func MailerSend(subject, email, message string) error
- func RegisterUser(db *gorm.DB, UserInformation *Users) error
- func RemoveBarrierIP(db *gorm.DB, barrierIP string) error
- func RemoveLoginSession(db *gorm.DB, SessionID string) error
- func RemoveTableGameSession(db *gorm.DB) (*gorm.DB, error)
- func RemoveTableGameSessionID(db *gorm.DB, id string) (*gorm.DB, error)
- func Server(port string) error
- type BarrierIP
- type GameSession
- type LoginSession
- type ServerSpecs
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddServerSpecs ¶
func AddServerSpecs(db *gorm.DB, gameSession *GameSession) error
AddServerSpecs Add server specs
func CheckIfBarrierAddressExists ¶
CheckIfBarrierAddressExists Check if the barrier ip address with port exists
func CheckIfEmailAndPasswordMatch ¶
CheckIfEmailAndPasswordMatch Check email and password information for login
func CheckIfEmailExits ¶
CheckIfEmailExits Function to check if the username has been taken already or not
func CreateTables ¶
CreateTables CreateDB Add tables to the database
func MailerSend ¶
MailerSend This function sends an automated email to the person requesting it
func RegisterUser ¶
RegisterUser Function to insert new user information
func RemoveBarrierIP ¶
RemoveBarrierIP Remove barrier row based on the IP address provided
func RemoveLoginSession ¶
RemoveLoginSession Removes session from the database based on the session ID provided
func RemoveTableGameSession ¶
RemoveTableGameSession Removes table of type
Types ¶
type BarrierIP ¶
type BarrierIP struct {
ID string `bson: ID`
BarrierIP string `form:"BarrierIP" binding:"required" bson:hostname`
MachineName string `form:"MachineName" binding:"required" bson:hostname`
UserID string `json:"UserID"`
User Users `gorm:"foreignKey:UserID;references:UserID" json:"ServerInformation"`
}
BarrierIP Barrier connection information
type GameSession ¶
type GameSession struct {
GameSessionID string `json:"GameSessionID"`
// Link of the stream started for gameplay
Link string `form:"Link" binding:"required" json:"LinkID"`
ServerID string `json:"ServerID"`
Rate float64 `form:"Rate" binding:"required" json:"Rate"`
Server ServerSpecs `gorm:"foreignKey:ID;references:ServerID" json:"ServerInformation"`
// State of the server if it's in use
// or free
State bool
UserID string `json:"UserID"`
User Users `gorm:"foreignKey:UserID;references:UserID" json:"ServerInformation"`
}
GameSession A single Game session. In the following implementation the server can have only 1 user occupying it por session.
func DisplayGameSessions ¶
func DisplayGameSessions(db *gorm.DB) ([]*GameSession, error)
DisplayGameSessions Returns all the rows of all the game session information to display
type LoginSession ¶
type LoginSession struct {
SessionKey string `json:"SessionKey"`
UserID string `json:"UserID"`
User Users `gorm:"foreignKey:UserID;references:UserID" json:"Users"`
}
LoginSession Storing information of the login session
func CreateLoginSession ¶
func CreateLoginSession(db *gorm.DB, user *Users) (*LoginSession, error)
CreateLoginSession function to create login session and setting expiry time for the login session
type ServerSpecs ¶
type ServerSpecs struct {
ID string `bson: ID`
Hostname string `form:"Hostname" binding:"required" bson:hostname`
Platform string `form:"Platform" binding:"required" bson:platform`
CPU string `form:"CPU" binding:"required" bson:cpu`
RAM string `form:"RAM" binding:"required" bson:ram`
Disk string `form:"Disk" binding:"required" bson:disk`
GPU string `form:"GPU" binding:"required" bson:GPU`
}
ServerSpecs Server specs information
func GetSeverSpecs ¶
func GetSeverSpecs(db *gorm.DB, ID string) (*ServerSpecs, error)
GetSeverSpecs Get server specs information based on the ID provided