Documentation ¶
Index ¶
- type EmailConfirmation
- type PasswordResetRequest
- type Session
- type User
- type UserRepository
- type UserRepositorySqlite
- func (r *UserRepositorySqlite) ConfirmEmail(token string) error
- func (repo *UserRepositorySqlite) Create(user User) error
- func (r *UserRepositorySqlite) CreateEmailConfirmation(email string, expiryTime time.Time) (EmailConfirmation, error)
- func (r *UserRepositorySqlite) CreatePasswordResetRequest(email string, expiryTime time.Time) (PasswordResetRequest, error)
- func (r *UserRepositorySqlite) CreateSession(userUUID string) (Session, error)
- func (repo *UserRepositorySqlite) Delete(userUUID string) error
- func (r *UserRepositorySqlite) DeletePasswordResetRequest(token string) error
- func (r *UserRepositorySqlite) DeleteSession(token string) error
- func (repo *UserRepositorySqlite) GetByEmail(email string) (User, error)
- func (repo *UserRepositorySqlite) GetByUUID(userUUID string) (User, error)
- func (repo *UserRepositorySqlite) GetByUserName(userName string) (User, error)
- func (r *UserRepositorySqlite) GetEmailConfirmation(token string) (*EmailConfirmation, error)
- func (r *UserRepositorySqlite) GetPasswordResetRequest(token string) (PasswordResetRequest, error)
- func (r *UserRepositorySqlite) GetSession(token string) (Session, error)
- func (r *UserRepositorySqlite) Signup(user User) error
- func (repo *UserRepositorySqlite) Update(user User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailConfirmation ¶
type PasswordResetRequest ¶
type UserRepository ¶
type UserRepositorySqlite ¶
type UserRepositorySqlite struct {
// contains filtered or unexported fields
}
func NewUserRepositorySqlite ¶
func NewUserRepositorySqlite(dbPath string) (*UserRepositorySqlite, error)
func (*UserRepositorySqlite) ConfirmEmail ¶
func (r *UserRepositorySqlite) ConfirmEmail(token string) error
This method takes a token string, queries the email_confirmations table for the corresponding record, and scans the result into a new EmailConfirmation struct. If the token is not found, it returns an error. If there's any other error during the query, it returns an error as well.
func (*UserRepositorySqlite) Create ¶
func (repo *UserRepositorySqlite) Create(user User) error
func (*UserRepositorySqlite) CreateEmailConfirmation ¶
func (r *UserRepositorySqlite) CreateEmailConfirmation(email string, expiryTime time.Time) (EmailConfirmation, error)
This method takes an email address and a token duration, generates a new email confirmation token, creates a new EmailConfirmation struct with the required fields, and inserts the record into the email_confirmations table. Add a new GetEmailConfirmation method to the `UserRepository
func (*UserRepositorySqlite) CreatePasswordResetRequest ¶
func (r *UserRepositorySqlite) CreatePasswordResetRequest(email string, expiryTime time.Time) (PasswordResetRequest, error)
func (*UserRepositorySqlite) CreateSession ¶
func (r *UserRepositorySqlite) CreateSession(userUUID string) (Session, error)
func (*UserRepositorySqlite) Delete ¶
func (repo *UserRepositorySqlite) Delete(userUUID string) error
func (*UserRepositorySqlite) DeletePasswordResetRequest ¶
func (r *UserRepositorySqlite) DeletePasswordResetRequest(token string) error
func (*UserRepositorySqlite) DeleteSession ¶
func (r *UserRepositorySqlite) DeleteSession(token string) error
DeleteSession deletes a session by token
func (*UserRepositorySqlite) GetByEmail ¶
func (repo *UserRepositorySqlite) GetByEmail(email string) (User, error)
func (*UserRepositorySqlite) GetByUUID ¶
func (repo *UserRepositorySqlite) GetByUUID(userUUID string) (User, error)
func (*UserRepositorySqlite) GetByUserName ¶
func (repo *UserRepositorySqlite) GetByUserName(userName string) (User, error)
func (*UserRepositorySqlite) GetEmailConfirmation ¶
func (r *UserRepositorySqlite) GetEmailConfirmation(token string) (*EmailConfirmation, error)
func (*UserRepositorySqlite) GetPasswordResetRequest ¶
func (r *UserRepositorySqlite) GetPasswordResetRequest(token string) (PasswordResetRequest, error)
func (*UserRepositorySqlite) GetSession ¶
func (r *UserRepositorySqlite) GetSession(token string) (Session, error)
GetSession get a session by token
func (*UserRepositorySqlite) Signup ¶
func (r *UserRepositorySqlite) Signup(user User) error
func (*UserRepositorySqlite) Update ¶
func (repo *UserRepositorySqlite) Update(user User) error