Documentation
¶
Index ¶
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashPassword, password string) error
- type Post
- func (p *Post) DeleteAPost(db *gorm.DB, postId, authorId int) (int64, error)
- func (p *Post) FindAllPosts(db *gorm.DB) (*[]Post, error)
- func (p *Post) FindPostByID(db *gorm.DB, postId int) (*Post, error)
- func (p *Post) Prepare()
- func (p *Post) SavePost(db *gorm.DB) (*Post, error)
- func (p *Post) UpdateAPost(db *gorm.DB, postId int) (*Post, error)
- func (p *Post) Validate() error
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(db *gorm.DB, uid int64) (int64, error)
- func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)
- func (u *User) FindUserByID(db *gorm.DB, uid uint64) (*User, error)
- func (u *User) Prepare()
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateAUser(db *gorm.DB, uid int64) (*User, error)
- func (u *User) Validate(operation string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
Types ¶
type Post ¶
type Post struct { ID int `gorm:"primary_key;auto_increment" json:"id"` Title string `gorm:"size:255;not null;unique" json:"title"` Content string `gorm:"size:255;not null;" json:"content"` Author User `json:"author"` AuthorID int `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) DeleteAPost ¶
type User ¶
type User struct { ID int `gorm:"primary_key;auto_increment" json:"id"` Firstname string `gorm:"size:255;not null" json:"firstname"` Lastname string `gorm:"size:255;not null" json:"lastname"` Email string `gorm:"size:100;not null;unique" json:"email"` Password string `gorm:"size:100;not null" json:"password"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func (*User) BeforeSave ¶
Click to show internal directories.
Click to hide internal directories.