Documentation ¶
Index ¶
- Variables
- func GetUser(ctx context.Context, c redis.Cmdable, user *User) (pensive.User, error)
- func PostUpdate(ctx context.Context, c redis.Cmdable, userID int64, body, mediaID string) error
- func UpdateEmail(ctx context.Context, c redis.Cmdable, userID int64, ...) error
- func UpdatePassword(ctx context.Context, c redis.Cmdable, userID int64, ...) error
- func UpdateUser(ctx context.Context, c redis.Cmdable, userID int64, ...) error
- func UpdateUsername(ctx context.Context, c redis.Cmdable, userID int64, ...) error
- type Manager
- type Post
- func (p *Post) Body(ctx context.Context) (string, error)
- func (p *Post) CreatedAt(ctx context.Context) (*time.Time, error)
- func (p *Post) MediaID(ctx context.Context) (string, error)
- func (p *Post) UpdatedAt(ctx context.Context) (*time.Time, error)
- func (p *Post) User(ctx context.Context) (*User, error)
- type User
- func AddUser(ctx context.Context, c redis.Cmdable, username string, password []byte, ...) (*User, error)
- func AuthSelf(r *http.Request, s *sessions.Session, c redis.Cmdable, key string) (*User, error)
- func AuthUser(ctx context.Context, c redis.Cmdable, username, password string) (*User, error)
- func GetUserByName(ctx context.Context, c redis.Cmdable, username string) (*User, error)
- func GetUserByUserID(c redis.Cmdable, userID int64) (*User, error)
- func RegisterUser(ctx context.Context, c redis.Cmdable, username, password, email string) (*User, error)
- func (u *User) CreatedAt(ctx context.Context) (*time.Time, error)
- func (u *User) Email(ctx context.Context) (string, error)
- func (u *User) ID() int64
- func (u *User) IsVerified(ctx context.Context) (bool, error)
- func (u *User) Password(ctx context.Context) ([]byte, error)
- func (u *User) SetEmail(ctx context.Context, value string) error
- func (u *User) SetPassword(ctx context.Context, value []byte) error
- func (u *User) SetUsername(ctx context.Context, value string) error
- func (u *User) UpdateNow(ctx context.Context) error
- func (u *User) UpdatedAt(ctx context.Context) (*time.Time, error)
- func (u *User) Username(ctx context.Context) (string, error)
- func (u *User) Verify(ctx context.Context, value bool) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUsernameTaken common error on registration form when the username already existed ErrUsernameTaken = errors.New("username taken") // ErrUserNotFound common error on login form when the user is not found ErrUserNotFound = errors.New("user not found") // ErrTypeMismatch specific error for capturing type mismatch ErrTypeMismatch = errors.New("the type didn't match") // ErrNilClient gives error message when redis client variable is nil ErrNilClient = errors.New("client is nil") // ErrEmptyForm gives error message when form body is empty ErrEmptyForm = errors.New("form is empty") // ErrPerm gives error message when self tries to modify other accounts details ErrPerm = errors.New("permission to modify is denied") )
Functions ¶
func PostUpdate ¶
PostUpdate adds a new update; this differs from edit which actually changes
func UpdateEmail ¶
func UpdateEmail(ctx context.Context, c redis.Cmdable, userID int64, newEmail, oldPassword string) error
UpdateEmail authenticates the user by its username and password and updates it with new ones userID is the current user requesting
func UpdatePassword ¶
func UpdatePassword(ctx context.Context, c redis.Cmdable, userID int64, oldPassword, newPassword string) error
UpdatePassword authenticates the user by its username and password and updates it with new ones userID is the current user requesting
Types ¶
type Post ¶
type Post struct {
// contains filtered or unexported fields
}
Post user generated inputs
func AddPost ¶
AddPost creates a new post, saves it to the database, and returns the newly created question
func GetAllPosts ¶
GetAllPosts All Updates getter
type User ¶
type User struct {
// contains filtered or unexported fields
}
User the general people
func AddUser ¶
func AddUser(ctx context.Context, c redis.Cmdable, username string, password []byte, email string) (*User, error)
AddUser this creates a new user entry
func GetUserByName ¶
GetUserByName gets the user using the username
func GetUserByUserID ¶
GetUserByUserID gets user using a user id
func RegisterUser ¶
func RegisterUser(ctx context.Context, c redis.Cmdable, username, password, email string) (*User, error)
RegisterUser register a valid user
func (*User) IsVerified ¶
IsVerified getter
func (*User) SetPassword ¶
SetPassword Password Hash setter
func (*User) SetUsername ¶
SetUsername Username setter