Documentation ¶
Index ¶
- type Comment
- func (c *Comment) DeleteAComment(db *gorm.DB) (int64, error)
- func (c *Comment) DeletePostComments(db *gorm.DB, pid uint64) (int64, error)
- func (c *Comment) DeleteUserComments(db *gorm.DB, uid uint32) (int64, error)
- func (c *Comment) GetComments(db *gorm.DB, pid uint64) (*[]Comment, error)
- func (c *Comment) Prepare()
- func (c *Comment) SaveComment(db *gorm.DB) (*Comment, error)
- func (c *Comment) UpdateAComment(db *gorm.DB) (*Comment, error)
- func (c *Comment) Validate(action string) map[string]string
- type Like
- func (l *Like) DeleteLike(db *gorm.DB) (*Like, error)
- func (l *Like) DeletePostLikes(db *gorm.DB, pid uint64) (int64, error)
- func (l *Like) DeleteUserLikes(db *gorm.DB, uid uint32) (int64, error)
- func (l *Like) GetLikesInfo(db *gorm.DB, pid uint64) (*[]Like, error)
- func (l *Like) SaveLike(db *gorm.DB) (*Like, error)
- type Post
- func (p *Post) DeleteAPost(db *gorm.DB) (int64, error)
- func (c *Post) DeleteUserPosts(db *gorm.DB, uid uint32) (int64, error)
- func (p *Post) FindAllPosts(db *gorm.DB) (*[]Post, error)
- func (p *Post) FindPostByID(db *gorm.DB, pid uint64) (*Post, error)
- func (p *Post) FindUserPosts(db *gorm.DB, uid uint32) (*[]Post, error)
- func (p *Post) Prepare()
- func (p *Post) SavePost(db *gorm.DB) (*Post, error)
- func (p *Post) UpdateAPost(db *gorm.DB) (*Post, error)
- func (p *Post) Validate() map[string]string
- type ResetPassword
- type User
- func (u *User) AfterFind() (err error)
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(db *gorm.DB, uid uint32) (int64, error)
- func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)
- func (u *User) FindUserByID(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Prepare()
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateAUser(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) UpdateAUserAvatar(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) UpdatePassword(db *gorm.DB) error
- func (u *User) Validate(action string) map[string]string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` UserID uint32 `gorm:"not null" json:"user_id"` PostID uint64 `gorm:"not null" json:"post_id"` Body string `gorm:"text;not null;" json:"body"` User User `json:"user"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func (*Comment) DeletePostComments ¶
When a post is deleted, we also delete the comments that the post had
func (*Comment) DeleteUserComments ¶
When a user is deleted, we also delete the comments that the user had
func (*Comment) GetComments ¶
type Like ¶
type Like struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` UserID uint32 `gorm:"not null" json:"user_id"` PostID uint64 `gorm:"not null" json:"post_id"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func (*Like) DeletePostLikes ¶
When a post is deleted, we also delete the likes that the post had
func (*Like) DeleteUserLikes ¶
When a post is deleted, we also delete the likes that the post had
type Post ¶
type Post struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` Title string `gorm:"size:255;not null;unique" json:"title"` Content string `gorm:"text;not null;" json:"content"` Author User `json:"author"` AuthorID uint32 `gorm:"not null" json:"author_id"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func (*Post) DeleteUserPosts ¶
When a user is deleted, we also delete the post that the user had
type ResetPassword ¶
type ResetPassword struct { gorm.Model Email string `gorm:"size:100;not null;" json:"email"` Token string `gorm:"size:255;not null;" json:"token"` }
func (*ResetPassword) DeleteDatails ¶
func (resetPassword *ResetPassword) DeleteDatails(db *gorm.DB) (int64, error)
func (*ResetPassword) Prepare ¶
func (resetPassword *ResetPassword) Prepare()
func (*ResetPassword) SaveDatails ¶
func (resetPassword *ResetPassword) SaveDatails(db *gorm.DB) (*ResetPassword, error)
type User ¶
type User struct { ID uint32 `gorm:"primary_key;auto_increment" json:"id"` Username string `gorm:"size:255;not null;unique" json:"username"` Email string `gorm:"size:100;not null;unique" json:"email"` Password string `gorm:"size:100;not null;" json:"password"` AvatarPath string `gorm:"size:255;null;" json:"avatar_path"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func (*User) BeforeSave ¶
func (*User) FindAllUsers ¶
THE ONLY PERSON THAT NEED TO DO THIS IS THE ADMIN, SO I HAVE COMMENTED THE ROUTES, SO SOMEONE ELSE DONT VIEW THIS DETAILS.
func (*User) UpdateAUserAvatar ¶
Click to show internal directories.
Click to hide internal directories.