models

package
v0.0.0-...-650c96b Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Room

type Room struct {
	gorm.Model
	Owner          User   `gorm:"foreignkey:OwnerID"`
	OwnerID        uint   `gorm:"UNIQUE_INDEX;NOT_NULL"`
	HashedPassword string `gorm:"type:CHAR(100)"`
	Name           string `gorm:"type:VARCHAR(36);UNIQUE_INDEX;NOT_NULL"`
}

Room is a room a user can create, it can optionally be secured with a passowrd

type RoomVideo

type RoomVideo struct {
	gorm.Model
	Room        Room
	RoomID      uint  `gorm:"INDEX;NOT NULL"`
	Requester   User  `gorm:"foreignkey:RequesterID"`
	RequesterID uint  `gorm:"INDEX"`
	Video       Video `gorm:"foreignkey:VideoID"`
	VideoID     uint  `gorm:"INDEX"`
}

RoomVideo represents a video in a room's video history

type User

type User struct {
	gorm.Model
	DiscordID                string `gorm:"type:VARCHAR(100);UNIQUE;UNIQUE_INDEX;NOT NULL"`
	LastDiscordUsername      string `gorm:"type:VARCHAR(32)"`
	LastDiscordDiscriminator string `gorm:"type:VARCHAR(4)"`
}

User is identified by their discord ID, and we keep track of their last known discord username and discriminator (i.e. bob#9832).

type UserAuth

type UserAuth struct {
	gorm.Model
	AccessToken  string    `gorm:"type:VARCHAR(30);index"`
	RefreshToken string    `gorm:"type:VARCHAR(30);index"`
	ExpiresAt    time.Time `gorm:"index"`
	UserID       uint      `gorm:"UNIQUE_INDEX;NOT_NULL"`
	User         User
}

UserAuth contains the Discord OAuth credentials for the user identified by foreign key,

func (UserAuth) TableName

func (UserAuth) TableName() string

TableName sets the UserAuth model's table name as user_auth

type Video

type Video struct {
	gorm.Model
	Title     string `gorm:"type:VARCHAR(100);INDEX;NOT NULL"`
	YoutubeID string `gorm:"type:VARCHAR(11);UNIQUE_INDEX;NOT NULL"`
}

Video represents a YouTube video that is played in a room

Jump to

Keyboard shortcuts

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