Documentation ¶
Overview ¶
Package postgres contains repository implementation for postgres database.
Index ¶
- func Connect(ctx context.Context, dsn string, log pgx.Logger, logLevel string) (*pgxpool.Pool, error)
- type User
- type UsersRepository
- func (repo *UsersRepository) Activate(ctx context.Context, token string) (*domain.User, error)
- func (repo *UsersRepository) Create(ctx context.Context, email string, password []byte) (*domain.User, error)
- func (repo *UsersRepository) FetchRecoveryToken(ctx context.Context, email string) (*domain.User, error)
- func (repo *UsersRepository) FindAll(ctx context.Context) ([]domain.User, error)
- func (repo *UsersRepository) FindOne(ctx context.Context, id string) (*domain.User, error)
- func (repo *UsersRepository) FindOneByEmail(ctx context.Context, email string) (*domain.User, error)
- func (repo *UsersRepository) ResetPassword(ctx context.Context, recoveryToken string, password []byte) (*domain.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type User ¶
type User struct { ID string Email string Password pgtype.Bytea Activated pgtype.Timestamptz Created pgtype.Timestamptz Updated pgtype.Timestamptz ActivationToken pgtype.UUID RecoveryToken pgtype.UUID Active bool }
User entity.
type UsersRepository ¶
type UsersRepository struct {
// contains filtered or unexported fields
}
UsersRepository implements repository.Users interface using PostgreSQL database.
func NewUserRepository ¶
func NewUserRepository(conn *pgxpool.Pool) *UsersRepository
NewUserRepository creates new users repository using PostgreSQL database.
func (*UsersRepository) Create ¶
func (repo *UsersRepository) Create(ctx context.Context, email string, password []byte) (*domain.User, error)
Create creates new user in PostgreSQL database.
func (*UsersRepository) FetchRecoveryToken ¶
func (repo *UsersRepository) FetchRecoveryToken(ctx context.Context, email string) (*domain.User, error)
FetchRecoveryToken sets user's password reset token in PostgreSQL repository.
func (*UsersRepository) FindOneByEmail ¶
func (repo *UsersRepository) FindOneByEmail(ctx context.Context, email string) (*domain.User, error)
FindOneByEmail fetches user from PostgreSQL database using email address.
func (*UsersRepository) ResetPassword ¶
func (repo *UsersRepository) ResetPassword(ctx context.Context, recoveryToken string, password []byte, ) (*domain.User, error)
ResetPassword sets new user's password in PostgreSQL database.
Click to show internal directories.
Click to hide internal directories.