Documentation
¶
Index ¶
- func NewPostgreDB(cfg *repository.DBConfig) (*sqlx.DB, error)
- type AccountsRepository
- func (r *AccountsRepository) ChangePassword(ctx context.Context, email, passwordHash string) (err error)
- func (r *AccountsRepository) CreateAccount(ctx context.Context, account models.Account) (restx repository.Transaction, id string, err error)
- func (r *AccountsRepository) DeleteAccount(ctx context.Context, accountID string) (restx repository.Transaction, err error)
- func (r *AccountsRepository) GetAccountByEmail(ctx context.Context, email string) (account models.Account, err error)
- func (r *AccountsRepository) GetAccountEmail(ctx context.Context, accountID string) (email string, err error)
- func (r *AccountsRepository) IsAccountWithEmailExist(ctx context.Context, email string) (exist bool, err error)
- func (r *AccountsRepository) PingContext(ctx context.Context) error
- func (r *AccountsRepository) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPostgreDB ¶
func NewPostgreDB(cfg *repository.DBConfig) (*sqlx.DB, error)
NewPostgreDB creates a new connection to the PostgreSQL database.
Types ¶
type AccountsRepository ¶
type AccountsRepository struct {
// contains filtered or unexported fields
}
func NewAccountsRepository ¶
func NewAccountsRepository(db *sqlx.DB, logger *logrus.Logger) *AccountsRepository
NewAccountsRepository creates a new instance of the accountsRepository using the provided database connection.
func (*AccountsRepository) ChangePassword ¶
func (r *AccountsRepository) ChangePassword(ctx context.Context, email, passwordHash string) (err error)
ChangePassword updates the password hash of an account with the given email in the database. It takes the email and the new password hash as input and returns an error, if any.
func (*AccountsRepository) CreateAccount ¶
func (r *AccountsRepository) CreateAccount(ctx context.Context, account models.Account) (restx repository.Transaction, id string, err error)
CreateAccount creates a new account in the database.
func (*AccountsRepository) DeleteAccount ¶
func (r *AccountsRepository) DeleteAccount(ctx context.Context, accountID string) (restx repository.Transaction, err error)
DeleteAccount deletes the account with the given ID from the database. It takes the ID of the account as input and returns an error, if any.
func (*AccountsRepository) GetAccountByEmail ¶
func (r *AccountsRepository) GetAccountByEmail(ctx context.Context, email string) (account models.Account, err error)
GetAccountByEmail retrieves a account from the database based on the provided email. It returns the retrieved account and an error, if any.
func (*AccountsRepository) GetAccountEmail ¶
func (*AccountsRepository) IsAccountWithEmailExist ¶
func (r *AccountsRepository) IsAccountWithEmailExist(ctx context.Context, email string) (exist bool, err error)
IsAccountWithEmailExist checks if an account with the given email exists in the database. It returns a boolean indicating the existence and an error, if any.
func (*AccountsRepository) PingContext ¶
func (r *AccountsRepository) PingContext(ctx context.Context) error
func (*AccountsRepository) Shutdown ¶
func (r *AccountsRepository) Shutdown()
Shutdown closes the database connection.