Documentation ¶
Index ¶
- type UserRepository
- type UserRepositoryImpl
- func (repo *UserRepositoryImpl) Create(ctx context.Context, user entity.User, roleIDs []int) (id int, err error)
- func (repo *UserRepositoryImpl) Delete(ctx context.Context, id int) (err error)
- func (repo *UserRepositoryImpl) GetAll(ctx context.Context, filter model.RequestGetAll) (users []entity.User, total int, err error)
- func (repo *UserRepositoryImpl) GetByConditions(ctx context.Context, conds map[string]any) (user *entity.User, err error)
- func (repo *UserRepositoryImpl) GetByEmail(ctx context.Context, email string) (user *entity.User, err error)
- func (repo *UserRepositoryImpl) GetByID(ctx context.Context, id int) (user *entity.User, err error)
- func (repo *UserRepositoryImpl) Update(ctx context.Context, user entity.User) (err error)
- func (repo *UserRepositoryImpl) UpdatePassword(ctx context.Context, id int, passwordHashed string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserRepository ¶
type UserRepository interface { // Create adds a new user to the repository with a specified role. Create(ctx context.Context, user entity.User, roleIDs []int) (id int, err error) // GetByID retrieves a user by their unique identifier. GetByID(ctx context.Context, id int) (user *entity.User, err error) // GetByEmail retrieves a user by their email address. GetByEmail(ctx context.Context, email string) (user *entity.User, err error) // GetByConditions retrieves a user based on specified conditions. GetByConditions(ctx context.Context, conds map[string]any) (user *entity.User, err error) // GetAll retrieves all users based on a filter for pagination. GetAll(ctx context.Context, filter model.RequestGetAll) (users []entity.User, total int, err error) // Update modifies user information in the repository. Update(ctx context.Context, user entity.User) (err error) // UpdatePassword updates a user's password in the repository. UpdatePassword(ctx context.Context, id int, passwordHashed string) (err error) // Delete removes a user from the repository by their ID. Delete(ctx context.Context, id int) (err error) }
func NewUserRepository ¶
func NewUserRepository() UserRepository
type UserRepositoryImpl ¶
type UserRepositoryImpl struct {
// contains filtered or unexported fields
}
func (*UserRepositoryImpl) Delete ¶
func (repo *UserRepositoryImpl) Delete(ctx context.Context, id int) (err error)
func (*UserRepositoryImpl) GetAll ¶
func (repo *UserRepositoryImpl) GetAll(ctx context.Context, filter model.RequestGetAll) (users []entity.User, total int, err error)
func (*UserRepositoryImpl) GetByConditions ¶
func (*UserRepositoryImpl) GetByEmail ¶
func (*UserRepositoryImpl) UpdatePassword ¶
Click to show internal directories.
Click to hide internal directories.