Documentation ¶
Index ¶
- Constants
- Variables
- func AuthenticateUser(email, password string) (*schemas.User, error)
- func ChooseUsername(userId ksuid.KSUID, username string) error
- func CreateFollowRelation(fromUser ksuid.KSUID, toUser ksuid.KSUID) (bool, error)
- func DeleteFollowRelation(fromUser ksuid.KSUID, toUser ksuid.KSUID) error
- func DeleteUserToken(id ksuid.KSUID) error
- func DeleteUserTokenFromToken(token string) error
- func GenerateUserToken(userId ksuid.KSUID, issuedFromIP string, expiredAt ...time.Time) (string, error)
- func GetUser(userId ksuid.KSUID) (*schemas.User, error)
- func GetUserByUsername(username string, host ...string) (*schemas.User, error)
- func GetUserEmail(userId ksuid.KSUID) (string, error)
- func GetUserFromToken(token string) (*schemas.User, error)
- func InsertTokenCookie(c *fiber.Ctx, token string)
- func IsEmailVerified(userId ksuid.KSUID) (bool, error)
- func IssueEmailToken(userId ksuid.KSUID, email string) error
- func ListUserToken(userId ksuid.KSUID) ([]*schemas.UserToken, error)
- func RegisterLocalAccount(email, password string, skipEmailVerify bool) (*schemas.User, error)
- func UpdateUser(user *schemas.User) error
- func VerifyEmailToken(token string) error
Constants ¶
View Source
const (
TokenCookieName = "mn_token"
)
Variables ¶
View Source
var ( ErrInvalidCredentials = errors.New("invalid credentials") ErrUserNotFound = errors.New("user not found") ErrUserGone = errors.New("user is gone") )
View Source
var ( LocalUsernameRegexp = regexp.MustCompile(`^\w{1,32}$`) UsernameRegexp = regexp.MustCompile(`\w+([a-zA-Z\d_.-]+\w+)?`) )
View Source
var ( ErrInvalidToken = errors.New("token is not valid") ErrEmailExists = errors.New("email is already exists") ErrUsernameAlreadyTaken = errors.New("username is already taken") ErrUsernameAlreadyChosen = errors.New("username is already chosen") ErrInvalidUsernameFormat = errors.New("invalid username format") )
View Source
var ( ErrCannotRelationYourself = errors.New("you can't change your own relationship") ErrAlreadyFollowing = errors.New("you're already following") ErrNotFollowing = errors.New("you are not following") )
View Source
var (
ErrInvalidUserToken = errors.New("invalid user token")
)
Functions ¶
func CreateFollowRelation ¶
func DeleteFollowRelation ¶
func DeleteUserToken ¶
func GenerateUserToken ¶
func GetUserByUsername ¶
func InsertTokenCookie ¶
func InsertTokenCookie(c *fiber.Ctx, token string)
func RegisterLocalAccount ¶
func UpdateUser ¶
func VerifyEmailToken ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.