// GetEmailToken fetches the given email token.
GetEmailToken fetches the given email token.
// GetEmailToken fetches the given email token .
func GetEmailToken(token string) (EmailToken, error) {
	storedToken, err := RedisClient.HGetAll("token:" + token).Result()
	if err == redis.Nil {
		return EmailToken{}, ErrNotFound
	} else if err != nil {
		return EmailToken{}, err
	}
	if storedToken["type"] == "" {
		return EmailToken{}, ErrNotFound
	}
	tokenType, err := strconv.Atoi(storedToken["type"])
	if err != nil {
		return EmailToken{}, err
	}
	userID, err := strconv.Atoi(storedToken["userID"])
	if err != nil {
		return EmailToken{}, err
	}
	response := EmailToken{
		Token:    token,
		Type:     EmailTokenType(tokenType),
		Metadata: storedToken["metadata"],
		UserID:   userID,
	}
	return response, nil
}
func GetEmailToken ( token string ) ( EmailToken , error ) { storedToken , err := RedisClient . HGetAll ( " " + token ) . Result ( ) if err == redis . Nil { return EmailToken { } , ErrNotFound } else if err != nil { return EmailToken { } , err } if storedToken [ " " ] == " " { return EmailToken { } , ErrNotFound } tokenType , err := strconv . Atoi ( storedToken [ " " ] ) if err != nil { return EmailToken { } , err } userID , err := strconv . Atoi ( storedToken [ " " ] ) if err != nil { return EmailToken { } , err } response := EmailToken { Token : token , Type : EmailTokenType ( tokenType ) , Metadata : storedToken [ " " ] , UserID : userID , } return response , nil }
GetEmailToken fetches the given email token.
GetEmailToken fetches the given email token .