repository

package
v0.0.0-...-e2b7729 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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) Create

func (repo *UserRepositoryImpl) Create(ctx context.Context, user entity.User, roleIDs []int) (id int, err error)

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 (repo *UserRepositoryImpl) GetByConditions(ctx context.Context, conds map[string]any) (user *entity.User, err error)

func (*UserRepositoryImpl) GetByEmail

func (repo *UserRepositoryImpl) GetByEmail(ctx context.Context, email string) (user *entity.User, err error)

func (*UserRepositoryImpl) GetByID

func (repo *UserRepositoryImpl) GetByID(ctx context.Context, id int) (user *entity.User, err error)

func (*UserRepositoryImpl) Update

func (repo *UserRepositoryImpl) Update(ctx context.Context, user entity.User) (err error)

func (*UserRepositoryImpl) UpdatePassword

func (repo *UserRepositoryImpl) UpdatePassword(ctx context.Context, id int, passwordHashed string) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL