Documentation
¶
Index ¶
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashedPassword, password string) error
- type Article
- func (a *Article) CreateArticle(db *gorm.DB) (*Article, error)
- func (a *Article) DeleteArticle(db *gorm.DB, aid uint32) (int64, error)
- func (a Article) GetAllArticles(db *gorm.DB) ([]Article, error)
- func (a Article) GetArticleByID(db *gorm.DB, id uint32) (*Article, error)
- func (a Article) GetArticleBySlug(db *gorm.DB, slug string) (*Article, error)
- func (a *Article) Prepare()
- func (a Article) UpdateArticle(db *gorm.DB, aid uint32) (Article, error)
- func (a *Article) Validate() error
- type User
- func (u *User) CreateUser(db *gorm.DB) (*User, error)
- func (u *User) DeleteUserByID(db *gorm.DB, uid uint32) (int64, error)
- func (u *User) GetAllUsers(db *gorm.DB) (*[]User, error)
- func (u *User) GetUserByID(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Prepare()
- func (u *User) UpdateUser(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
Types ¶
type Article ¶
type Article struct { ID uint32 `gorm:"primary_key;auto_increment;" json:"id"` Slug string `gorm:"size:255;not null;unique" json:"slug"` SubHeader string `gorm:"type:longtext;not null;" json:"sub_header"` Title string `gorm:"size:255;not null;unique" json:"title"` Body string `gorm:"type:longtext;not null" json:"body"` Category string `gorm:"size:255;not null" json:"category"` Tags string `json:"tags"` AuthorID uint32 `gorm:"not null;" json:"author_id,omitempty"` CreatedAt time.Time `gorm:"not null;" json:"created_at"` UpdatedAt time.Time `gorm:"not null;" json:"updated_at"` }
func (*Article) DeleteArticle ¶
func (Article) GetArticleByID ¶
func (Article) GetArticleBySlug ¶
func (Article) UpdateArticle ¶
type User ¶
type User struct { ID uint32 `gorm:"primary_key;auto_increment" json:"id"` Username string `gorm:"size:255;not null;unique" json:"username"` Name string `gorm:"size:255;" json:"name"` Email string `gorm:"size:255;not null;unique" json:"email,omitempty"` ShowEmail bool `gorm:"default:false;not null;" json:"-"` Password string `gorm:"size:100;not null;" json:"password,omitempty"` Role string `gorm:"size:100;not null;" json:"role"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.