Documentation ¶
Index ¶
Constants ¶
View Source
const ISO8601 = "2006-01-02T15:04:05-0700Z"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { gorm.Model Title string `gorm:"not null"` Description string `gorm:"not null"` Body string `gorm:"not null"` Tags []Tag `gorm:"many2many:article_tags"` Author User `gorm:"foreignkey:UserID"` UserID uint `gorm:"not null"` FavoritesCount int32 `gorm:"not null;default=0"` FavoritedUsers []User `gorm:"many2many:favorite_articles"` Comments []Comment }
Article model
func (*Article) ProtoArticle ¶
ProtoArticle generates proto aritcle model from article
type Comment ¶
type Comment struct { gorm.Model Body string `gorm:"not null"` UserID uint `gorm:"not null"` Author User `gorm:"foreignkey:UserID"` ArticleID uint `gorm:"not null"` Article Article }
Comment model
func (*Comment) ProtoComment ¶
ProtoComment generates proto comment model from article
type User ¶
type User struct { gorm.Model Username string `gorm:"unique_index;not null"` Email string `gorm:"unique_index;not null"` Password string `gorm:"not null"` Bio string `gorm:"not null"` Image string `gorm:"not null"` Follows []User `gorm:"many2many:follows;jointable_foreignkey:from_user_id;association_jointable_foreignkey:to_user_id"` FavoriteArticles []Article `gorm:"many2many:favorite_articles;"` }
User is user model
func (*User) CheckPassword ¶
CheckPassword checki user password correct
func (*User) HashPassword ¶
HashPassword makes password field crypted
func (*User) ProtoProfile ¶
ProtoProfile generates proto profile model from user
Click to show internal directories.
Click to hide internal directories.