Documentation ¶
Index ¶
- Constants
- func GeneratePassword(password string) (string, error)
- type Comment
- type Model
- type Post
- type PostMeta
- type User
- func CreateUser(db *sqlex.DB, username, email, password string) (*User, error)
- func GetUser(db *sqlex.DB, id interface{}) (*User, error)
- func GetUserByEmail(db *sqlex.DB, email string) (*User, error)
- func GetUserByPasswordResetToken(db *sqlex.DB, token string) (*User, error)
- func GetUserByUsername(db *sqlex.DB, username string) (*User, error)
- func GetUserByVerificationToken(db *sqlex.DB, token string) (*User, error)
- func (u *User) GeneratePasswordResetToken(db *sqlex.DB) error
- func (u *User) GenerateVerificationToken(db *sqlex.DB) error
- func (u User) GetID() string
- func (u User) IsActive() bool
- func (u User) IsDeleted() bool
- func (u *User) UpdatePassword(db *sqlex.DB, password string) error
- func (u User) ValidatePassword(password string) error
- func (u *User) ValidatePasswordResetToken(duration int64) error
- func (u *User) ValidateVerificationToken(duration int64) error
- func (u *User) VerifyEmail(db *sqlex.DB) error
Constants ¶
View Source
const ( PostStateDeleted = 0 PostStateDraft = 1 PostStatePublished = 2 PostTypePost = 1 PostTypePage = 2 PostTypeRevision = 3 )
View Source
const ( UserStateDeleted = 0 UserStateInactive = 1 UserStateActive = 2 )
User states.
View Source
const (
PostMetaMarkdownContent = "markdown_content"
)
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶
Types ¶
type Post ¶
type Post struct { ID int64 `db:"id" json:"id"` UserID int64 `db:"user_id" json:"user_id"` Title string `db:"title" json:"title"` Content string `db:"content" json:"content"` State int `db:"state" json:"state"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt sqlex.NullTime `db:"updated_at" json:"updated_at"` }
type PostMeta ¶
type User ¶
type User struct { ID int64 `db:"id" json:"id"` Username string `db:"username" json:"username"` Email string `db:"email" json:"email"` VerificationToken sqlex.NullString `db:"verification_token"` HashedPassword string `db:"hashed_password"` PasswordResetToken sqlex.NullString `db:"password_reset_token"` State int `db:"state" json:"state"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt sqlex.NullTime `db:"updated_at" json:"updated_at"` DeletedAt sqlex.NullTime `db:"deleted_at" json:"deleted_at"` }
func (*User) GeneratePasswordResetToken ¶
func (*User) GenerateVerificationToken ¶
func (User) ValidatePassword ¶
func (*User) ValidatePasswordResetToken ¶
func (*User) ValidateVerificationToken ¶
Click to show internal directories.
Click to hide internal directories.