Documentation ¶
Index ¶
- type CodeRepo
- func (r *CodeRepo) Create(code *models.Code) error
- func (r *CodeRepo) Delete(code *models.Code) error
- func (r *CodeRepo) ExtendExpiration(code *models.Code) error
- func (r *CodeRepo) FindAll() (*[]models.Code, error)
- func (r *CodeRepo) FindByID(ID int) (*models.Code, error)
- func (r *CodeRepo) GetByCode(Code int) (*models.Code, error)
- func (r *CodeRepo) GetLastIsActiveCode(UserID int, Action string) (*models.Code, error)
- func (r *CodeRepo) NewCode(UserID int, Action string, Data string) (*models.Code, error)
- func (r *CodeRepo) Update(code *models.Code) error
- type TokensRepo
- func (r *TokensRepo) CreateCacheKey(userID int, td *models.TokenDetails) error
- func (r *TokensRepo) CreateToken(userid int) (*models.TokenDetails, error)
- func (r *TokensRepo) DecodeAccessToken(tokenString string) (*models.AccessTokenClaims, error)
- func (r *TokensRepo) DecodeRefreshToken(tokenString string) (*models.RefreshTokenClaims, error)
- func (r *TokensRepo) DropCacheKey(UUID string) error
- func (r *TokensRepo) DropCacheTokens(accessTokenClaims models.AccessTokenClaims) error
- func (r *TokensRepo) GetCacheValue(UUID string) (*string, error)
- type UserRepo
- func (r *UserRepo) Create(user *models.User) error
- func (r *UserRepo) Delete(user *models.User) error
- func (r *UserRepo) FindAll() (*[]models.User, error)
- func (r *UserRepo) FindByEmail(Email string) (*models.User, error)
- func (r *UserRepo) FindByGoogleID(GoogleID string) (*models.User, error)
- func (r *UserRepo) FindByID(ID int) (*models.User, error)
- func (r *UserRepo) PasswordMatches(user *models.User, plainText string) (bool, error)
- func (r *UserRepo) ResetPassword(user *models.User, password string) error
- func (r *UserRepo) Update(user *models.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeRepo ¶
type CodeRepo struct {
// contains filtered or unexported fields
}
func NewCodeRepo ¶
func (*CodeRepo) GetLastIsActiveCode ¶
type TokensRepo ¶
type TokensRepo struct {
// contains filtered or unexported fields
}
func NewTokensRepo ¶
func NewTokensRepo(cache *redis.Client) *TokensRepo
func (*TokensRepo) CreateCacheKey ¶
func (r *TokensRepo) CreateCacheKey(userID int, td *models.TokenDetails) error
CreateCacheKey function that will be used to save the JWTs metadata in Redis
func (*TokensRepo) CreateToken ¶
func (r *TokensRepo) CreateToken(userid int) (*models.TokenDetails, error)
CreateToken returns JWT Token
func (*TokensRepo) DecodeAccessToken ¶
func (r *TokensRepo) DecodeAccessToken(tokenString string) (*models.AccessTokenClaims, error)
func (*TokensRepo) DecodeRefreshToken ¶
func (r *TokensRepo) DecodeRefreshToken(tokenString string) (*models.RefreshTokenClaims, error)
func (*TokensRepo) DropCacheKey ¶
func (r *TokensRepo) DropCacheKey(UUID string) error
DropCacheKey function that will be used to drop the JWTs metadata from Redis
func (*TokensRepo) DropCacheTokens ¶
func (r *TokensRepo) DropCacheTokens(accessTokenClaims models.AccessTokenClaims) error
func (*TokensRepo) GetCacheValue ¶
func (r *TokensRepo) GetCacheValue(UUID string) (*string, error)
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
func NewUserRepo ¶
func (*UserRepo) FindByGoogleID ¶
func (*UserRepo) PasswordMatches ¶
PasswordMatches uses Go's bcrypt package to compare a user supplied password with the hash we have stored for a given user in the database. If the password and hash match, we return true; otherwise, we return false.
func (*UserRepo) ResetPassword ¶
ResetPassword is the method we will use to change a user's password.
Click to show internal directories.
Click to hide internal directories.