Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func InitializeDb ¶
Types ¶
type Category ¶
type Post ¶
type Post struct { Model Title string `json:"title" binding:"required,max=100,min=2"` Description string `sql:"type:text;" json:"description" binding:"required,max=100,min=2"` OgType string `json:"og_type" binding:"required,max=100,min=2"` OgUrl string `json:"og_url" binding:"required,max=100,min=2"` Image string `json:"image"` Body string `sql:"type:text;" json:"body" binding:"required,min=2"` Category []*Category `gorm:"many2many:post_categories;"` Profanity bool `json:"profanity" binding:"required"` UserId string `json:"user_id" binding:"required"` Status string `json:"status" binding:"required"` }
func (*Post) AssignCategory ¶
type PostCategories ¶
type PostCategories []PostCategory
func (*PostCategories) GetByPostId ¶
func (p *PostCategories) GetByPostId(id int64)
type PostCategory ¶
type PostCategory struct { Model PostId uint `json:"post_id" binding:"required"` CategoryId uint `json:"category_id" binding:"required"` }
func (*PostCategory) Create ¶
func (p *PostCategory) Create()
type User ¶
type User struct { Model Name string `json:"name" binding:"required,max=100,min=2"` Email string `json:"email" binding:"required,email,uniqueEmail" gorm:"type:varchar(200);unique_index"` Password string `json:"password" binding:"required,min=6,max=20"` }
func (*User) FindByEmail ¶
func (u *User) FindByEmail()
Click to show internal directories.
Click to hide internal directories.