Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DBConn database access DBConn *gorm.DB // RedisClient redis cache access RedisClient redis.Client )
Functions ¶
func InitDatabase ¶
func InitDatabase()
InitDatabase configures database connection from environment variables
Types ¶
type Forum ¶
type Forum struct { gorm.Model Name string `json:"name" gorm:"not null" form:"name"` Description string `json:"description" gorm:"size:256"` Open bool `json:"Open" gorm:"default:true"` UserID uint `json:"userid" gorm:"not null"` User User Threads []Thread Members []Member Tags []Tag `gorm:"many2many:forum_tags;"` }
Forum model
type GUser ¶
type GUser struct { Name string `json:"name"` Picture string `json:"picture"` Email string `json:"email"` }
GUser model for Google Sign-in user information
type Image ¶
type Image struct { gorm.Model FileName string UserID uint `json:"userid" gorm:"not null"` User User }
Image model for user uploaded image
type LoginUser ¶
type LoginUser struct { Email string `json:"email"` Pass1 string `json:"pass1"` Csrf string `json:"csrf" form:"csrf"` }
LoginUser form model for user login
type Member ¶
type Member struct { gorm.Model ForumID uint `json:"ForumID" gorm:"not null"` Forum Forum UserID uint `json:"UserID" gorm:"not null"` User User }
Member model for forum member
type NewForum ¶
type NewForum struct { Name string `json:"name" form:"name"` Description string `json:"description" form:"description"` Csrf string `json:"csrf" form:"csrf"` }
NewForum form model
type NewThread ¶
type NewThread struct { Title string `json:"title" form:"title"` Body string `json:"body" form:"body"` Csrf string `json:"csrf" form:"csrf"` }
NewThread form model for new thread
type NewUser ¶
type NewUser struct { DisplayName string `json:"DisplayName"` Email string `json:"email"` Pass1 string `json:"pass1"` Pass2 string `json:"pass2"` Csrf string `json:"csrf" form:"csrf"` }
NewUser form model for new user registration
type PendingMember ¶
type PendingMember struct { gorm.Model ForumID uint `json:"ForumID" gorm:"not null"` Forum Forum UserID uint `json:"UserID" gorm:"not null"` User User }
PendingMember model for pending member requests to join private forum
type Post ¶
type Post struct { gorm.Model Body string `json:"body" gorm:"not null"` UserID uint `json:"userid" gorm:"not null"` User User ThreadID uint `json:"thread_id" gorm:"not null"` Thread Thread }
Post model for post reply in a thread
type Thread ¶
type Thread struct { gorm.Model Title string `json:"title" gorm:"not null"` Body string `json:"body" gorm:"not null"` Date time.Time `json:"date" ` UserID uint `json:"userid" gorm:"not null"` User User ForumID uint `json:"forum_id" gorm:"constraint:OnDelete:CASCADE;"` Forum Forum Posts []Post `json:""` }
Thread model for thread
type UpdateForum ¶
type UpdateForum struct { Name string `json:"name" form:"name"` Description string `json:"description" form:"description"` Open bool `json:"Open" form:"open"` Csrf string `json:"csrf" form:"csrf"` }
UpdateForum form model
type UpdateThread ¶
type UpdateThread struct { Title string `json:"title" form:"title"` Body string `json:"body" form:"body"` Csrf string `json:"csrf" form:"csrf"` Date time.Time `json:"date" form:"date"` }
UpdateThread form model for update thread
type User ¶
type User struct { gorm.Model DisplayName string `json:"DisplayName" gorm:"unique;not null"` Email string `json:"email" gorm:"unique;not null"` Picture string `json:"picture"` Password []byte `json:"-"` Posts []Post `json:"-"` Threads []Thread `json:"-"` Forums []Forum `json:"-"` }
User model for user
Click to show internal directories.
Click to hide internal directories.